diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2021-06-18 12:38:35 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-20 16:21:12 +0200 |
commit | 67394861ab067cd087bf951b4e13bd79bf58863c (patch) | |
tree | 65dde8283aba72f15f21581774dda6fcc3ca765d | |
parent | dc138ac10ed44f906561badc353556f212f101ee (diff) | |
download | linux-stable-67394861ab067cd087bf951b4e13bd79bf58863c.tar.gz linux-stable-67394861ab067cd087bf951b4e13bd79bf58863c.tar.bz2 linux-stable-67394861ab067cd087bf951b4e13bd79bf58863c.zip |
usb: gadget: hid: fix error return code in hid_bind()
[ Upstream commit 88693f770bb09c196b1eb5f06a484a254ecb9924 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/usb/gadget/legacy/hid.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c index a71a884f79fc..cccbb948821b 100644 --- a/drivers/usb/gadget/legacy/hid.c +++ b/drivers/usb/gadget/legacy/hid.c @@ -175,8 +175,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; |