mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: mass_storage: fix error return code in msg_bind()
@ 2020-11-12  8:53 Chen Zhou
  2020-11-12 13:23 ` chenzhou
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Zhou @ 2020-11-12  8:53 UTC (permalink / raw)
  To: balbi
  Cc: gregkh, weiyongjun1, jun.li, rogerq, linux-usb, linux-kernel,
	chenzhou10, Hulk Robot

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..7a88c5282d61 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 (IS_ERR(usb_desc)) {
+			status = PTR_ERR(usb_desc);
 			goto fail_string_ids;
+		}
 		usb_otg_descriptor_init(cdev->gadget, usb_desc);
 		otg_desc[0] = usb_desc;
 		otg_desc[1] = NULL;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: gadget: mass_storage: fix error return code in msg_bind()
  2020-11-12  8:53 [PATCH] usb: gadget: mass_storage: fix error return code in msg_bind() Chen Zhou
@ 2020-11-12 13:23 ` chenzhou
  0 siblings, 0 replies; 2+ messages in thread
From: chenzhou @ 2020-11-12 13:23 UTC (permalink / raw)
  To: balbi
  Cc: gregkh, weiyongjun1, jun.li, rogerq, linux-usb, linux-kernel, Hulk Robot



On 2020/11/12 16:53, Chen Zhou wrote:
> 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..7a88c5282d61 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 (IS_ERR(usb_desc)) {
> +			status = PTR_ERR(usb_desc);
>  			goto fail_string_ids;
> +		}
>  		usb_otg_descriptor_init(cdev->gadget, usb_desc);
>  		otg_desc[0] = usb_desc;
>  		otg_desc[1] = NULL;
Ignore this.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-12 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12  8:53 [PATCH] usb: gadget: mass_storage: fix error return code in msg_bind() Chen Zhou
2020-11-12 13:23 ` chenzhou

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®