Skip to contentSkip to conversation

USB: Don't dereference snd->filp

PATCH In review Roel Kluin 2 participants 2 messages Sep 29, 2010 – Sep 30, 2010 USB

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 USB: Don't dereference snd->filp

Don't dereference snd->filp.

---
 drivers/usb/gadget/u_audio.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Or should it return the error pointer?

drivers/usb/gadget/u_audio.c +1 -0
index 7a86d2c..38d0305 100644
@@ -242,6 +242,7 @@ static int gaudio_open_snd_dev(struct gaudio *card)
 	if (IS_ERR(snd->filp)) {
 		ERROR(card, "No such PCM playback device: %s\n", fn_play);
 		snd->filp = NULL;
+		return 0;
 	}
 	pcm_file = snd->filp->private_data;
 	snd->substream = pcm_file->substream;
#1 lore raw
Quoted 8 lines · Roel Kluin

Don't dereference snd->filp.

---
 drivers/usb/gadget/u_audio.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Or should it return the error pointer?

Probably, what happens if you do?

thanks,

greg k-h