Re: [PATCH v2 04/22] usb: serial: ti_usb_3410_5052: Remove useless NULL-testing

Johan Hovold
2016-08-23T08:04:25Z

On Tue, Jul 26, 2016 at 07:59:44PM +0200, Mathieu OTHACEHE wrote:
> It is useless to check the return of usb_get_serial_port_data.

Please be more specific in your commit messages in general. In this case
it should mention that there's no need to check for NULL private data in
the tty or tty-port callbacks.

> Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
> ---
> 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 b694d69..c8ed3f9 100644
> --- a/drivers/usb/serial/ti_usb_3410_5052.c
> +++ b/drivers/usb/serial/ti_usb_3410_5052.c
> @@ -653,9 +653,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;
>
> @@ -784,8 +781,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;

You also forgot to mention that you are removing a check for interface
private data in close().

I fixes this up before applying this time.

Thanks,
Johan