diff options
author | Johan Hovold <johan@kernel.org> | 2017-02-08 20:53:09 +0300 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2017-02-08 23:20:49 +0300 |
commit | 0e517c93dc027e49d4523fe32631606b12f0752d (patch) | |
tree | 47100fb3e8ccfd7bc43b810e748debde700c722a /drivers/usb/serial/console.c | |
parent | 14816b16fa0adac24f82492f18fa62c55acabbbe (diff) | |
download | linux-0e517c93dc027e49d4523fe32631606b12f0752d.tar.xz |
USB: serial: console: clean up sanity checks
Drop two redundant NULL checks from usb_serial_console_disconnect().
The usb_serial_console_disconnect function is called from the
USB-serial-device disconnect callback when a device is going away. Hence
there is no need to check for the serial-device pointer being NULL.
The serial-device port pointers are stored in an array that is a member
of the serial struct so the address of the first member of the array
(which the array name decays to) is never NULL either.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/console.c')
-rw-r--r-- | drivers/usb/serial/console.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index b6f1adefb758..fdf89800ebc3 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c @@ -265,8 +265,7 @@ static struct console usbcons = { void usb_serial_console_disconnect(struct usb_serial *serial) { - if (serial && serial->port && serial->port[0] - && serial->port[0] == usbcons_info.port) { + if (serial->port[0] == usbcons_info.port) { usb_serial_console_exit(); usb_serial_put(serial); } |