From: Peter Chen <peter.chen@nxp.com>
To: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Cc: "balbi@kernel.org" <balbi@kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"jun.li@freescale.com" <jun.li@freescale.com>
Subject: Re: [PATCH] usb: gadget: ether: Fix wrong return value of eth_bind()
Date: Mon, 16 Nov 2020 14:03:12 +0000 [thread overview]
Message-ID: <20201116140242.GH28313@b29397-desktop> (raw)
In-Reply-To: <20201112134820.2257361-1-zhangxiaoxu5@huawei.com>
On 20-11-12 08:48:20, Zhang Xiaoxu wrote:
> If the otg descriptor allocate failed, we should return -ENOMEM,
> rather than the 'status' from 'usb_string_ids_tab'.
>
> Fixes: 9b95236eebdb ("usb: gadget: ether: allocate and init otg descriptor by otg capabilities")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Peter
> ---
> drivers/usb/gadget/legacy/ether.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/legacy/ether.c b/drivers/usb/gadget/legacy/ether.c
> index 30313b233680..99c7fc0d1d59 100644
> --- a/drivers/usb/gadget/legacy/ether.c
> +++ b/drivers/usb/gadget/legacy/ether.c
> @@ -403,8 +403,10 @@ static int eth_bind(struct usb_composite_dev *cdev)
> struct usb_descriptor_header *usb_desc;
>
> usb_desc = usb_otg_descriptor_alloc(gadget);
> - if (!usb_desc)
> + if (!usb_desc) {
> + status = -ENOMEM;
> goto fail1;
> + }
> usb_otg_descriptor_init(gadget, usb_desc);
> otg_desc[0] = usb_desc;
> otg_desc[1] = NULL;
> --
> 2.25.4
>
--
Thanks,
Peter Chen
prev parent reply other threads:[~2020-11-16 14:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 13:48 [PATCH] usb: gadget: ether: Fix wrong return value of eth_bind() Zhang Xiaoxu
2020-11-16 14:03 ` Peter Chen [this message]
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=20201116140242.GH28313@b29397-desktop \
--to=peter.chen@nxp.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@freescale.com \
--cc=linux-usb@vger.kernel.org \
--cc=zhangxiaoxu5@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;
as well as URLs for NNTP newsgroup(s).