[bug report] usb: gadget: bdc: use readl_poll_timeout() to simplify code

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

 



Hello Chunfeng Yun,

The patch 75ae051efc9b: "usb: gadget: bdc: use readl_poll_timeout()
to simplify code" from Jul 13, 2020, leads to the following static
checker warning:

	drivers/usb/gadget/udc/bdc/bdc_core.c:38 poll_oip()
	warn: sleeping in atomic context

drivers/usb/gadget/udc/bdc/bdc_core.c
    33 static int poll_oip(struct bdc *bdc, u32 usec)
    34 {
    35 	u32 status;
    36 	int ret;
    37 
--> 38 	ret = readl_poll_timeout(bdc->regs + BDC_BDCSC, status,
    39 				 (BDC_CSTS(status) != BDC_OIP), 10, usec);
                                                                ^^
This adds a 10us sleep, but we're holding a spin lock so it's a sleeping
in atomic bug.  One call tree is:

bdc_udc_stop() <-- takes a spin lock
  --> bdc_stop
      --> poll_oip() <-- sleep

    40 	if (ret)
    41 		dev_err(bdc->dev, "operation timedout BDCSC: 0x%08x\n", status);
    42 	else
    43 		dev_dbg(bdc->dev, "%s complete status=%d", __func__, BDC_CSTS(status));
    44 
    45 	return ret;
    46 }

regards,
dan carpenter



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

  Powered by Linux