usb: gadget: hid: fix error code in do_config()
Subsystems (2)
PATCH 1/1 usb: gadget: hid: fix error code in do_config()
Return an error code if usb_get_function() fails. Don't return success.
Fixes 4bc8a33f2407 ("usb: gadget: hid: convert to new interface of f_hid")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/usb/gadget/legacy/hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/hid.c +3 -1
@@ -99,8 +99,10 @@ static int do_config(struct usb_configuration *c)list_for_each_entry (e, &hidg_func_list, node) { e->f =usb_get_function (e->fi); -if (IS_ERR (e->f)) +if (IS_ERR (e->f)) { + status =PTR_ERR (e->f); goto put; + } status =usb_add_function (c, e->f);if (status <0 ) {usb_put_function (e->f);
Signature · 1 line
2.20.1
Hi,
Quoted 13 lines · Dan Carpenter
Return an error code if
usb_get_function()fails. Don't return success.Fixes 4bc8a33f2407 ("usb: gadget: hid: convert to new interface of f_hid")Signed-off-by Dan Carpenter <[email protected]>--- drivers/usb/gadget/legacy/hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/usb/gadget/legacy/hid.c +0
-0
drivers/usb/gadget/legacy/hid.c static int do_config(struct usb_configuration *c) · line 103
Quoted 6 lines
drivers/usb/gadget/legacy/hid.c +2
-1@@ -99,8 +99,10 @@ static int do_config(struct usb_configuration *c)list_for_each_entry (e, &hidg_func_list, node) { e->f =usb_get_function (e->fi); -if (IS_ERR (e->f)) +if (IS_ERR (e->f)) { + status =PTR_ERR (e->f);
nice catch! :-)
Acked-by Felipe Balbi <[email protected]>
Signature · 1 line
balbi