Skip to contentSkip to conversation

emu10k1: correctly handling failed thread creation

PATCH Applied Insu Yun 2 participants 2 messages Jan 29, 2016 Sound

lore
Share & tools
lore

Insu Yun

author
#0 lore raw

PATCH v2 1/1 emu10k1: correctly handling failed thread creation

Since kthread_create can be failed, it needs to check whether error occurred and return error code.

---
 sound/pci/emu10k1/emu10k1_main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/pci/emu10k1/emu10k1_main.c +8 -0
index 28e2f8b..8914534 100644
@@ -1141,6 +1141,14 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
 		emu->emu1010.firmware_thread =
 			kthread_create(emu1010_firmware_thread, emu,
 				       "emu1010_firmware");
+		if (IS_ERR(emu->emu1010.firmware_thread)) {
+			err = PTR_ERR(emu->emu1010.firmware_thread);
+			emu->emu1010.firmware_thread = NULL;
+			dev_info(emu->card->dev,
+					"emu1010: Creating thread failed\n");
+			return err;
+		}
+
 		wake_up_process(emu->emu1010.firmware_thread);
 	}
 
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 5 lines · Insu Yun

Since kthread_create can be failed, it needs to check whether error occurred and return error code.

Applied, thanks.

Takashi

Quoted 31 lines
---
 sound/pci/emu10k1/emu10k1_main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/pci/emu10k1/emu10k1_main.c +8 -0
index 28e2f8b..8914534 100644
@@ -1141,6 +1141,14 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
 		emu->emu1010.firmware_thread =
 			kthread_create(emu1010_firmware_thread, emu,
 				       "emu1010_firmware");
+		if (IS_ERR(emu->emu1010.firmware_thread)) {
+			err = PTR_ERR(emu->emu1010.firmware_thread);
+			emu->emu1010.firmware_thread = NULL;
+			dev_info(emu->card->dev,
+					"emu1010: Creating thread failed\n");
+			return err;
+		}
+
 		wake_up_process(emu->emu1010.firmware_thread);
 	}
 
Signature · 6 lines
1.9.1

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel