From: Chen Zhou <chenzhou10@huawei.com>
To: <balbi@kernel.org>
Cc: <gregkh@linuxfoundation.org>, <weiyongjun1@huawei.com>,
<jun.li@freescale.com>, <rogerq@ti.com>,
<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<chenzhou10@huawei.com>, Hulk Robot <hulkci@huawei.com>
Subject: [PATCH v2] usb: gadget: mass_storage: fix error return code in msg_bind()
Date: Thu, 12 Nov 2020 21:54:23 +0800 [thread overview]
Message-ID: <20201112135423.89536-1-chenzhou10@huawei.com> (raw)
Fix to return a negative error code from the error handling case
instead of 0 in function msg_bind(), as done elsewhere in this
function.
Fixes: d86788979761 ("usb: gadget: mass_storage: allocate and init otg descriptor by otg capabilities")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
drivers/usb/gadget/legacy/mass_storage.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c
index 9ed22c5fb7fe..ac1741126619 100644
--- a/drivers/usb/gadget/legacy/mass_storage.c
+++ b/drivers/usb/gadget/legacy/mass_storage.c
@@ -175,8 +175,10 @@ static int msg_bind(struct usb_composite_dev *cdev)
struct usb_descriptor_header *usb_desc;
usb_desc = usb_otg_descriptor_alloc(cdev->gadget);
- if (!usb_desc)
+ if (!usb_desc) {
+ status = -ENOMEM;
goto fail_string_ids;
+ }
usb_otg_descriptor_init(cdev->gadget, usb_desc);
otg_desc[0] = usb_desc;
otg_desc[1] = NULL;
--
2.20.1
next reply other threads:[~2020-11-12 13:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 13:54 Chen Zhou [this message]
2020-11-16 14:01 ` Peter Chen
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=20201112135423.89536-1-chenzhou10@huawei.com \
--to=chenzhou10@huawei.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hulkci@huawei.com \
--cc=jun.li@freescale.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=weiyongjun1@huawei.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®