usb: class: cdc-wdm: return the correct errno code
PATCH 1/1 usb: class: cdc-wdm: return the correct errno code
From: Junlin Yang <[email protected]>
The "rv" is initialized to "-ENOMEM", because "rv" is re-assigned to "-EINVAL", when kmalloc & usb_alloc_urb failed, the return value should return "-ENOMEM" rather than "-EINVAL",so the "rv" assignment is placed in the position where usb_endpoint_is_int_in is false.
Signed-off-by Junlin Yang <[email protected]>
--- drivers/usb/class/cdc-wdm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/class/cdc-wdm.c +3 -2
@@ -1035,9 +1035,10 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptorINIT_WORK (&desc->rxwork, wdm_rxwork);INIT_WORK (&desc->service_outs_intr, service_interrupt_work); - rv = -EINVAL ; -if (!usb_endpoint_is_int_in (ep)) +if (!usb_endpoint_is_int_in (ep)) { + rv = -EINVAL ; goto err; + } desc->wMaxPacketSize =usb_endpoint_maxp (ep);
Signature · 1 line
1.9.1
Am Montag, den 21.06.2021, 21:24 +0800 schrieb Junlin Yang:
Quoted 10 lines
From: Junlin Yang <[email protected]>
The "rv" is initialized to "
-ENOMEM", because "rv" is re-assigned to "-EINVAL", when kmalloc &usb_alloc_urbfailed, the return value should
return "-ENOMEM" rather than "-EINVAL",so the "rv" assignment is placed
in the position whereusb_endpoint_is_int_inis false.Signed-off-by Junlin Yang <[email protected]>
Acked-by Oliver Neukum <[email protected]>