From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752815AbcELIua (ORCPT ); Thu, 12 May 2016 04:50:30 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33257 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932120AbcELIuY (ORCPT ); Thu, 12 May 2016 04:50:24 -0400 From: Mathieu OTHACEHE To: johan@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Mathieu OTHACEHE Subject: [PATCH 10/36] usb: serial: ti_usb_3410_5052: Remove useless NULL-testing Date: Thu, 12 May 2016 10:48:42 +0200 Message-Id: <1463042948-12205-11-git-send-email-m.othacehe@gmail.com> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1463042948-12205-1-git-send-email-m.othacehe@gmail.com> References: <1463042948-12205-1-git-send-email-m.othacehe@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is useless to check the return of usb_get_serial_port_data. Signed-off-by: Mathieu OTHACEHE --- drivers/usb/serial/ti_usb_3410_5052.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index c9e2345..ef6789b 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -638,9 +638,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) TI_PIPE_TIMEOUT_ENABLE | (TI_TRANSFER_TIMEOUT << 2)); - if (tport == NULL) - return -ENODEV; - dev = port->serial->dev; tdev = tport->tp_tdev; @@ -769,8 +766,6 @@ static void ti_close(struct usb_serial_port *port) tdev = usb_get_serial_data(port->serial); tport = usb_get_serial_port_data(port); - if (tdev == NULL || tport == NULL) - return; tport->tp_is_open = 0; @@ -812,7 +807,7 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, return 0; } - if (tport == NULL || !tport->tp_is_open) + if (!tport->tp_is_open) return -ENODEV; count = kfifo_in_locked(&port->write_fifo, data, count, @@ -830,9 +825,6 @@ static int ti_write_room(struct tty_struct *tty) int room = 0; unsigned long flags; - if (tport == NULL) - return 0; - spin_lock_irqsave(&tport->tp_lock, flags); room = kfifo_avail(&port->write_fifo); spin_unlock_irqrestore(&tport->tp_lock, flags); @@ -848,9 +840,6 @@ static int ti_chars_in_buffer(struct tty_struct *tty) int chars = 0; unsigned long flags; - if (tport == NULL) - return 0; - spin_lock_irqsave(&tport->tp_lock, flags); chars = kfifo_len(&port->write_fifo); spin_unlock_irqrestore(&tport->tp_lock, flags); @@ -876,9 +865,6 @@ static void ti_throttle(struct tty_struct *tty) struct usb_serial_port *port = tty->driver_data; struct ti_port *tport = usb_get_serial_port_data(port); - if (tport == NULL) - return; - if (I_IXOFF(tty) || C_CRTSCTS(tty)) ti_stop_read(tport, tty); @@ -891,9 +877,6 @@ static void ti_unthrottle(struct tty_struct *tty) struct ti_port *tport = usb_get_serial_port_data(port); int status; - if (tport == NULL) - return; - if (I_IXOFF(tty) || C_CRTSCTS(tty)) { status = ti_restart_read(tport, tty); if (status) @@ -908,9 +891,6 @@ static int ti_ioctl(struct tty_struct *tty, struct usb_serial_port *port = tty->driver_data; struct ti_port *tport = usb_get_serial_port_data(port); - if (tport == NULL) - return -ENODEV; - switch (cmd) { case TIOCGSERIAL: return ti_get_serial_info(tport, @@ -947,9 +927,6 @@ static void ti_set_termios(struct tty_struct *tty, old_termios->c_iflag); } - if (tport == NULL) - return; - config = kzalloc(sizeof(*config), GFP_KERNEL); if (!config) return; @@ -1070,9 +1047,6 @@ static int ti_tiocmget(struct tty_struct *tty) unsigned int mcr; unsigned long flags; - if (tport == NULL) - return -ENODEV; - spin_lock_irqsave(&tport->tp_lock, flags); msr = tport->tp_msr; mcr = tport->tp_shadow_mcr; @@ -1100,9 +1074,6 @@ static int ti_tiocmset(struct tty_struct *tty, unsigned int mcr; unsigned long flags; - if (tport == NULL) - return -ENODEV; - spin_lock_irqsave(&tport->tp_lock, flags); mcr = tport->tp_shadow_mcr; @@ -1131,9 +1102,6 @@ static void ti_break(struct tty_struct *tty, int break_state) struct ti_port *tport = usb_get_serial_port_data(port); int status; - if (tport == NULL) - return; - status = ti_write_byte(port, tport->tp_tdev, tport->tp_uart_base_addr + TI_UART_OFFSET_LCR, TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0); -- 2.8.2