[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210621132415.2341-1-angkery@163.com>
Date: Mon, 21 Jun 2021 21:24:15 +0800
From: Junlin Yang <angkery@....com>
To: gregkh@...uxfoundation.org, oneukum@...e.com,
penguin-kernel@...ove.sakura.ne.jp, loic.poulain@...aro.org,
davem@...emloft.net, lee.jones@...aro.org
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Junlin Yang <yangjunlin@...ong.com>
Subject: [PATCH] usb: class: cdc-wdm: return the correct errno code
From: Junlin Yang <yangjunlin@...ong.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@...ong.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
Powered by blists - more mailing lists