[alsa-devel] [PATCH] usb-audio: Check for possible chip NULL pointer before clearing probing flag

Thomas Pfaff tpfaff at gmx.net
Mon Sep 26 15:43:59 CEST 2011


Before clearing the probing flag in the error exit path, check that the 
chip pointer is not NULL.

Signed-off-by: Thomas Pfaff <tpfaff at gmx.net>

---
diff -urp a/sound/usb/card.c b/sound/usb/card.c
--- a/sound/usb/card.c	2011-09-26 14:58:02.468672118 +0200
+++ b/sound/usb/card.c	2011-09-26 15:00:30.313110086 +0200
@@ -530,9 +530,11 @@ snd_usb_audio_probe(struct usb_device *d
 	return chip;
 
  __error:
-	if (chip && !chip->num_interfaces)
-		snd_card_free(chip->card);
-	chip->probing = 0;
+	if (chip) {
+		if (!chip->num_interfaces)
+			snd_card_free(chip->card);
+		chip->probing = 0;
+	}
 	mutex_unlock(&register_mutex);
  __err_val:
 	return NULL;


More information about the Alsa-devel mailing list