* [bug report] net: macb: WoL support for GEM type of Ethernet controller
@ 2022-01-19 10:47 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-01-19 10:47 UTC (permalink / raw)
To: nicolas.ferre; +Cc: kernel-janitors
Hello Nicolas Ferre,
The patch 558e35ccfe95: "net: macb: WoL support for GEM type of
Ethernet controller" from Jul 20, 2020, leads to the following Smatch
static checker warning:
./include/linux/interrupt.h:215 devm_request_irq()
warn: sleeping in atomic context
The call tree is:
macb_suspend() <- disables preempt
macb_resume() <- disables preempt
-> devm_request_irq()
drivers/net/ethernet/cadence/macb_main.c
4922 static int __maybe_unused macb_resume(struct device *dev)
4923 {
4924 struct net_device *netdev = dev_get_drvdata(dev);
4925 struct macb *bp = netdev_priv(netdev);
4926 struct macb_queue *queue;
4927 unsigned long flags;
4928 unsigned int q;
4929 int err;
4930
4931 if (!netif_running(netdev))
4932 return 0;
4933
4934 if (!device_may_wakeup(dev))
4935 pm_runtime_force_resume(dev);
4936
4937 if (bp->wol & MACB_WOL_ENABLED) {
4938 spin_lock_irqsave(&bp->lock, flags);
Holding a spinlock
4939 /* Disable WoL */
4940 if (macb_is_gem(bp)) {
4941 queue_writel(bp->queues, IDR, GEM_BIT(WOL));
4942 gem_writel(bp, WOL, 0);
4943 } else {
4944 queue_writel(bp->queues, IDR, MACB_BIT(WOL));
4945 macb_writel(bp, WOL, 0);
4946 }
4947 /* Clear ISR on queue 0 */
4948 queue_readl(bp->queues, ISR);
4949 if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
4950 queue_writel(bp->queues, ISR, -1);
4951 /* Replace interrupt handler on queue 0 */
4952 devm_free_irq(dev, bp->queues[0].irq, bp->queues);
4953 err = devm_request_irq(dev, bp->queues[0].irq, macb_interrupt,
devm_request_irq() has a GFP_KERNEL allocation in it. The suspend and
resume function have this same bug.
4954 IRQF_SHARED, netdev->name, bp->queues);
4955 if (err) {
4956 dev_err(dev,
4957 "Unable to request IRQ %d (error %d)\n",
4958 bp->queues[0].irq, err);
4959 spin_unlock_irqrestore(&bp->lock, flags);
4960 return err;
4961 }
4962 spin_unlock_irqrestore(&bp->lock, flags);
4963
4964 disable_irq_wake(bp->queues[0].irq);
4965
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-19 10:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 10:47 [bug report] net: macb: WoL support for GEM type of Ethernet controller Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.