Skip to content

Commit 0e517c9

Browse files
committed
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 <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 14816b1 commit 0e517c9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/usb/serial/console.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,7 @@ static struct console usbcons = {
265265

266266
void usb_serial_console_disconnect(struct usb_serial *serial)
267267
{
268-
if (serial && serial->port && serial->port[0]
269-
&& serial->port[0] == usbcons_info.port) {
268+
if (serial->port[0] == usbcons_info.port) {
270269
usb_serial_console_exit();
271270
usb_serial_put(serial);
272271
}

0 commit comments

Comments
 (0)