Skip to content

Commit 29f6533

Browse files
Dan Carpentergregkh
authored andcommitted
usb: xhci: Clean up error code in xhci_dbc_tty_register_device()
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 95713fb commit 29f6533

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/usb/host/xhci-dbgtty.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,10 @@ int xhci_dbc_tty_register_device(struct xhci_hcd *xhci)
443443
xhci_dbc_tty_init_port(xhci, port);
444444
tty_dev = tty_port_register_device(&port->port,
445445
dbc_tty_driver, 0, NULL);
446-
ret = IS_ERR_OR_NULL(tty_dev);
447-
if (ret)
446+
if (IS_ERR(tty_dev)) {
447+
ret = PTR_ERR(tty_dev);
448448
goto register_fail;
449+
}
449450

450451
ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL);
451452
if (ret)

0 commit comments

Comments
 (0)