* [1/9] usb: xhci: Clean up error code in xhci_dbc_tty_register_device()
@ 2018-03-16 14:32 Mathias Nyman
0 siblings, 0 replies; only message in thread
From: Mathias Nyman @ 2018-03-16 14:32 UTC (permalink / raw)
To: gregkh; +Cc: linux-usb, Dan Carpenter
From: Dan Carpenter <dan.carpenter@oracle.com>
tty_port_register_device() returns error pointers on error, never NULL.
The IS_ERR_OR_NULL() function returns either 1 or 0 so it means we
return 1 on error instead of a proper error code. The caller only
checks for zero vs non-zero so this doesn't affect runtime.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/usb/host/xhci-dbgtty.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index 8d47b6f..6f534b6 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -443,9 +443,10 @@ int xhci_dbc_tty_register_device(struct xhci_hcd *xhci)
xhci_dbc_tty_init_port(xhci, port);
tty_dev = tty_port_register_device(&port->port,
dbc_tty_driver, 0, NULL);
- ret = IS_ERR_OR_NULL(tty_dev);
- if (ret)
+ if (IS_ERR(tty_dev)) {
+ ret = PTR_ERR(tty_dev);
goto register_fail;
+ }
ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL);
if (ret)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-16 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-16 14:32 [1/9] usb: xhci: Clean up error code in xhci_dbc_tty_register_device() Mathias Nyman
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).