kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: hid: fix error code in do_config()
@ 2021-10-11 12:37 Dan Carpenter
  2021-10-11 13:03 ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-10-11 12:37 UTC (permalink / raw)
  To: Felipe Balbi, Andrzej Pietrasiewicz
  Cc: Greg Kroah-Hartman, Yang Yingliang, linux-usb, kernel-janitors

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 <dan.carpenter@oracle.com>
---
 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);
 			goto put;
+		}
 		status = usb_add_function(c, e->f);
 		if (status < 0) {
 			usb_put_function(e->f);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: gadget: hid: fix error code in do_config()
  2021-10-11 12:37 [PATCH] usb: gadget: hid: fix error code in do_config() Dan Carpenter
@ 2021-10-11 13:03 ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2021-10-11 13:03 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrzej Pietrasiewicz, Greg Kroah-Hartman, Yang Yingliang,
	linux-usb, kernel-janitors


Hi,

Dan Carpenter <dan.carpenter@oracle.com> writes:

> 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 <dan.carpenter@oracle.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-11 13:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 12:37 [PATCH] usb: gadget: hid: fix error code in do_config() Dan Carpenter
2021-10-11 13:03 ` Felipe Balbi

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).