Skip to contentSkip to conversation

usb: early: Fix an error code in xdbc_init()

PATCH In review Yang Li 2 participants 2 messages Dec 21, 2021 USB

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 usb: early: Fix an error code in xdbc_init()

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'

---
 drivers/usb/early/xhci-dbc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/early/xhci-dbc.c +1 -0
index 4502108069cd..fcb05a8948fa 100644
@@ -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;
 	}
 
Signature · 1 line
2.20.1.7.g153144c
maintainer
#1 lore raw
Quoted 18 lines · Yang Li

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'

---
 drivers/usb/early/xhci-dbc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/early/xhci-dbc.c +0 -0
index 4502108069cd..fcb05a8948fa 100644

drivers/usb/early/xhci-dbc.c static int __init xdbc_init(void) · line 974

Quoted 6 lines
drivers/usb/early/xhci-dbc.c +1 -0
@@ -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