* [PATCH] usb: class: cdc-wdm: return the correct errno code
@ 2021-06-21 13:24 Junlin Yang
2021-06-21 13:34 ` Oliver Neukum
0 siblings, 1 reply; 2+ messages in thread
From: Junlin Yang @ 2021-06-21 13:24 UTC (permalink / raw)
To: gregkh, oneukum, penguin-kernel, loic.poulain, davem, lee.jones
Cc: linux-usb, linux-kernel, Junlin Yang
From: Junlin Yang <yangjunlin@yulong.com>
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 <yangjunlin@yulong.com>
---
drivers/usb/class/cdc-wdm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 8e5490a..fdf79bc 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -1035,9 +1035,10 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
INIT_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);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: class: cdc-wdm: return the correct errno code
2021-06-21 13:24 [PATCH] usb: class: cdc-wdm: return the correct errno code Junlin Yang
@ 2021-06-21 13:34 ` Oliver Neukum
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2021-06-21 13:34 UTC (permalink / raw)
To: Junlin Yang, gregkh, penguin-kernel, loic.poulain, davem, lee.jones
Cc: linux-usb, linux-kernel, Junlin Yang
Am Montag, den 21.06.2021, 21:24 +0800 schrieb Junlin Yang:
> From: Junlin Yang <yangjunlin@yulong.com>
>
> 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 <yangjunlin@yulong.com>
Acked-by: Oliver Neukum <oneukum@suse.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-21 13:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 13:24 [PATCH] usb: class: cdc-wdm: return the correct errno code Junlin Yang
2021-06-21 13:34 ` Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).