Skip to contentSkip to conversation

ALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check fails

PATCH Applied Colin King 2 participants 2 messages Apr 20, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check fails

From: Colin Ian King <[email protected]>

Currently when the call to usb_urb_ep_type_check fails (returning -EINVAL) the error return path returns -ENOMEM via the exit label "error". Other uses of the same error exit label set the err variable to -ENOMEM but this is not being used. I believe the original intent was for the error exit path to return the value in err rather than the hard coded -ENOMEM, so return this rather than the hard coded -ENOMEM.

Addresses-Coverity: ("Unused value")

Fixes 738d9edcfd44 ("ALSA: usb-audio: Add sanity checks for invalid EPs")
---
 sound/usb/midi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/midi.c +1 -1
index 9efda4b06acb..a10ac75969a8 100644
@@ -1316,7 +1316,7 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi,
 
  error:
 	snd_usbmidi_in_endpoint_delete(ep);
-	return -ENOMEM;
+	return err;
 }
 
 /*
Signature · 1 line
2.30.2
Applied
#1 lore raw
Quoted 10 lines · Colin King

From: Colin Ian King <[email protected]>

Currently when the call to usb_urb_ep_type_check fails (returning -EINVAL) the error return path returns -ENOMEM via the exit label "error". Other uses of the same error exit label set the err variable to -ENOMEM but this is not being used. I believe the original intent was for the error exit path to return the value in err rather than the hard coded -ENOMEM, so return this rather than the hard coded -ENOMEM.

Quoted 3 lines

Addresses-Coverity: ("Unused value")

Fixes 738d9edcfd44 ("ALSA: usb-audio: Add sanity checks for invalid EPs")

Thanks, applied.

Takashi