Re: [PATCH] usb: gadget: hid: fix error code in do_config()

From
Felipe Balbi <balbi@kernel.org>
Date
2021-10-11 13:03:36
Also in
linux-usb
Reply to
Dan Carpenter, 2021-10-11
Hi,

Dan Carpenter [off-list ref] writes:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 drivers/usb/gadget/legacy/hid.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c
index 5b27d289443f..3912cc805f3a 100644
--- a/drivers/usb/gadget/legacy/hid.c
+++ b/drivers/usb/gadget/legacy/hid.c
@@ -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 <balbi@kernel.org>

-- 
balbi
Thread (2 messages) 2 messages, 2 authors, last reply 2021-10-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help