From: Junlin Yang <angkery@163.com>
To: gregkh@linuxfoundation.org, oneukum@suse.com,
penguin-kernel@i-love.sakura.ne.jp, loic.poulain@linaro.org,
davem@davemloft.net, lee.jones@linaro.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Junlin Yang <yangjunlin@yulong.com>
Subject: [PATCH] usb: class: cdc-wdm: return the correct errno code
Date: Mon, 21 Jun 2021 21:24:15 +0800 [thread overview]
Message-ID: <20210621132415.2341-1-angkery@163.com> (raw)
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
next reply other threads:[~2021-06-21 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 13:24 Junlin Yang [this message]
2021-06-21 13:34 ` Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210621132415.2341-1-angkery@163.com \
--to=angkery@163.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=oneukum@suse.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=yangjunlin@yulong.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®