summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2021-06-18 12:38:35 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-21 11:27:54 +0200
commit88693f770bb09c196b1eb5f06a484a254ecb9924 (patch)
tree0ef40e0036e2e9d32ba8b3f3a6d750b65ad1bf2e /drivers/usb
parent4249d6fbc10fd997abdf8a1ea49c0389a0edf706 (diff)
downloadlinux-88693f770bb09c196b1eb5f06a484a254ecb9924.tar.bz2
usb: gadget: hid: fix error return code in hid_bind()
Fix to return a negative error code from the error handling case instead of 0. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210618043835.2641360-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/legacy/hid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c
index c4eda7fe7ab4..5b27d289443f 100644
--- a/drivers/usb/gadget/legacy/hid.c
+++ b/drivers/usb/gadget/legacy/hid.c
@@ -171,8 +171,10 @@ static int hid_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 put;
+ }
usb_otg_descriptor_init(gadget, usb_desc);
otg_desc[0] = usb_desc;
otg_desc[1] = NULL;