* [bug report] usb: gadget: bdc: use readl_poll_timeout() to simplify code
@ 2021-07-27 8:42 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-07-27 8:42 UTC (permalink / raw)
To: chunfeng.yun; +Cc: linux-usb
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-27 8:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 8:42 [bug report] usb: gadget: bdc: use readl_poll_timeout() to simplify code Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).