Re: [bug report] USB: opticon: switch to generic read implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 12, 2017 at 11:39:14PM +0300, Dan Carpenter wrote:
> Hello Johan Hovold,
> 
> The patch 7a6ee2b02751: "USB: opticon: switch to generic read
> implementation" from Nov 18, 2012, leads to the following static
> checker warning:
> 
> 	drivers/usb/serial/opticon.c:146 opticon_open()
> 	info: return a literal instead of 'res'
> 
> drivers/usb/serial/opticon.c
>    128  static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
>    129  {
>    130          struct opticon_private *priv = usb_get_serial_port_data(port);
>    131          unsigned long flags;
>    132          int res;
>    133  
>    134          spin_lock_irqsave(&priv->lock, flags);
>    135          priv->rts = false;
>    136          spin_unlock_irqrestore(&priv->lock, flags);
>    137  
>    138          /* Clear RTS line */
>    139          send_control_msg(port, CONTROL_RTS, 0);
>    140  
>    141          /* clear the halt status of the endpoint */
>    142          usb_clear_halt(port->serial->dev, port->read_urb->pipe);
>    143  
>    144          res = usb_serial_generic_open(tty, port);
>    145          if (!res)
>    146                  return res;
> 
> I think this if (!ret) statement is reversed.  In the original code we
> used to send RESEND_CTS_STATE on both the failure and success paths.

Indeed it is. Thanks for reporting this.
 
>    147  
>    148          /* Request CTS line state, sometimes during opening the current
>    149           * CTS state can be missed. */
>    150          send_control_msg(port, RESEND_CTS_STATE, 1);
>    151  
>    152          return res;
>    153  }

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux