Hello Guoqing Zhang,

The patch a6ff6cbf1fab: "usb: xhci: Add helper function
xhci_set_power_on()." from Apr 7, 2017, leads to the following static
checker warning:

        drivers/usb/host/xhci-hub.c:575 xhci_set_port_power()
        error: calling 'spin_unlock_irqrestore()' with bogus flags

drivers/usb/host/xhci-hub.c
   554  static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd 
*hcd,
   555                                  u16 index, bool on)
   556  {
   557          __le32 __iomem *addr;
   558          u32 temp;
   559          unsigned long flags = 0;
   560  
   561          addr = xhci_get_port_io_addr(hcd, index);
   562          temp = readl(addr);
   563          temp = xhci_port_state_to_neutral(temp);
   564          if (on) {
   565                  /* Power on */
   566                  writel(temp | PORT_POWER, addr);
   567                  temp = readl(addr);
   568                  xhci_dbg(xhci, "set port power, actual port %d status  
= 0x%x\n",
   569                                                  index, temp);
   570          } else {
   571                  /* Power off */
   572                  writel(temp & ~PORT_POWER, addr);
   573          }
   574  
   575          spin_unlock_irqrestore(&xhci->lock, flags);
                                                    ^^^^^
This won't work at all.  This is zero, not the original flags.  Please
CC me on the fix because I'm not subscribed to linux-usb.

   576          temp = usb_acpi_power_manageable(hcd->self.root_hub,
   577                                          index);
   578          if (temp)
   579                  usb_acpi_set_power_state(hcd->self.root_hub,
   580                          index, on);
   581          spin_lock_irqsave(&xhci->lock, flags);
   582  }

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

Reply via email to