Skip to contentSkip to conversation

lcs_start_kernel_thread(): handle kernel_thread failure

PATCH New Roel Kluin 1 participant 1 message Dec 19, 2008

Subsystems (3)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 lcs_start_kernel_thread(): handle kernel_thread failure

kernel_thread may fail, notice this.

---
 drivers/s390/net/lcs.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
drivers/s390/net/lcs.c +18 -5
index 0825be8..3b6f287 100644
@@ -1736,14 +1736,27 @@ lcs_stopcard(struct lcs_card *card)
 static void
 lcs_start_kernel_thread(struct work_struct *work)
 {
+	int retval;
 	struct lcs_card *card = container_of(work, struct lcs_card, kernel_thread_starter);
 	LCS_DBF_TEXT(5, trace, "krnthrd");
-	if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD))
-		kernel_thread(lcs_recovery, (void *) card, SIGCHLD);
+	if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) {
+		retval = kernel_thread(lcs_recovery, card, SIGCHLD);
+		if (retval < 0) {
+			dev_err(&card->dev->dev,
+				"Creating LCS recovery thread failed.\n");
+			return;
+		}
+	}
 #ifdef CONFIG_IP_MULTICAST
-	if (lcs_do_start_thread(card, LCS_SET_MC_THREAD))
-		kernel_thread(lcs_register_mc_addresses,
-				(void *) card, SIGCHLD);
+	if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) {
+		retval = kernel_thread(lcs_register_mc_addresses, card,
+				SIGCHLD);
+		if (retval < 0) {
+			dev_err(&card->dev->dev,
+				"Creating LCS multicast address failed.\n");
+			return;
+		}
+	}
 #endif
 }