linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] usb: early: Fix an error code in xdbc_init()
@ 2021-12-21  2:20 Yang Li
  2021-12-21  6:37 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-12-21  2:20 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, Yang Li, Abaci Robot

When xdbc_trace("hardware not used anymore\n") is performed,
ret should be assigned -ENODEV to indicate this.

Clean up smatch warning:
drivers/usb/early/xhci-dbc.c:972 xdbc_init() warn: missing error code
'ret'

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/usb/early/xhci-dbc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index 4502108069cd..fcb05a8948fa 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -969,6 +969,7 @@ static int __init xdbc_init(void)
 	if (early_xdbc_console.index == -1 ||
 	    (early_xdbc_console.flags & CON_BOOT)) {
 		xdbc_trace("hardware not used anymore\n");
+		ret = -ENODEV;
 		goto free_and_quit;
 	}
 
-- 
2.20.1.7.g153144c


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

* Re: [PATCH -next] usb: early: Fix an error code in xdbc_init()
  2021-12-21  2:20 [PATCH -next] usb: early: Fix an error code in xdbc_init() Yang Li
@ 2021-12-21  6:37 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-12-21  6:37 UTC (permalink / raw)
  To: Yang Li; +Cc: linux-usb, linux-kernel, Abaci Robot

On Tue, Dec 21, 2021 at 10:20:36AM +0800, Yang Li wrote:
> When xdbc_trace("hardware not used anymore\n") is performed,
> ret should be assigned -ENODEV to indicate this.
> 
> Clean up smatch warning:
> drivers/usb/early/xhci-dbc.c:972 xdbc_init() warn: missing error code
> 'ret'
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/usb/early/xhci-dbc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
> index 4502108069cd..fcb05a8948fa 100644
> --- a/drivers/usb/early/xhci-dbc.c
> +++ b/drivers/usb/early/xhci-dbc.c
> @@ -969,6 +969,7 @@ static int __init xdbc_init(void)
>  	if (early_xdbc_console.index == -1 ||
>  	    (early_xdbc_console.flags & CON_BOOT)) {
>  		xdbc_trace("hardware not used anymore\n");
> +		ret = -ENODEV;
>  		goto free_and_quit;
>  	}

How did you test this?

I think you just broke this, the function should be returning 0 here,
like it currently is.  Are you SURE smatch is correct?

I'll only accept this if you can prove it is tested.  Do you have this
hardware?

thanks,

greg k-h

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

end of thread, other threads:[~2021-12-21  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-21  2:20 [PATCH -next] usb: early: Fix an error code in xdbc_init() Yang Li
2021-12-21  6:37 ` Greg KH

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