re: usb: gadget: dummy_hcd: add SuperSpeed support

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

 



On Sat, 16 May 2015, Dan Carpenter wrote:

> Hello Tatyana Brokhman,
> 
> The patch 1cd8fd2887e1: "usb: gadget: dummy_hcd: add SuperSpeed
> support" from Jun 29, 2011, leads to the following static checker
> warning:
> 
> 	drivers/usb/gadget/udc/dummy_hcd.c:315 set_link_state_by_speed()
> 	warn: masked condition is always false. '(dum_hcd->port_status & 2) == 1'
> 
> drivers/usb/gadget/udc/dummy_hcd.c
>    291  static void set_link_state_by_speed(struct dummy_hcd *dum_hcd)
>    292  {
>    293          struct dummy *dum = dum_hcd->dum;
>    294  
>    295          if (dummy_hcd_to_hcd(dum_hcd)->speed == HCD_USB3) {
>    296                  if ((dum_hcd->port_status & USB_SS_PORT_STAT_POWER) == 0) {
>    297                          dum_hcd->port_status = 0;
>    298                  } else if (!dum->pullup || dum->udc_suspended) {
>    299                          /* UDC suspend must cause a disconnect */
>    300                          dum_hcd->port_status &= ~(USB_PORT_STAT_CONNECTION |
>    301                                                  USB_PORT_STAT_ENABLE);
>    302                          if ((dum_hcd->old_status &
>    303                               USB_PORT_STAT_CONNECTION) != 0)
>    304                                  dum_hcd->port_status |=
>    305                                          (USB_PORT_STAT_C_CONNECTION << 16);
>    306                  } else {
>    307                          /* device is connected and not suspended */
>    308                          dum_hcd->port_status |= (USB_PORT_STAT_CONNECTION |
>    309                                                   USB_PORT_STAT_SPEED_5GBPS) ;
>    310                          if ((dum_hcd->old_status &
>    311                               USB_PORT_STAT_CONNECTION) == 0)
>    312                                  dum_hcd->port_status |=
>    313                                          (USB_PORT_STAT_C_CONNECTION << 16);
>    314                          if ((dum_hcd->port_status &
>    315                               USB_PORT_STAT_ENABLE) == 1 &&
>                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
> Never true.  Maybe the == 1 was not intended?
> 
>    316                                  (dum_hcd->port_status &
>    317                                   USB_SS_PORT_LS_U0) == 1 &&

Indeed, this looks like a mistake also.  It might be okay, but you 
can't tell just by looking at it.

>    318                                  dum_hcd->rh_state != DUMMY_RH_SUSPENDED)
>    319                                  dum_hcd->active = 1;
>    320                  }
>    321          } else {

Alan Stern

--
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