netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: lantiq_etop: check the result of request_irq()
@ 2020-12-21  5:43 Masahiro Yamada
  2020-12-21 15:26 ` Andrew Lunn
  0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2020-12-21  5:43 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: linux-kernel, Masahiro Yamada, Miguel Ojeda, Andrew Lunn,
	Arnd Bergmann, Heiner Kallweit

The declaration of request_irq() in <linux/interrupt.h> is marked as
__must_check.

Without the return value check, I see the following warnings:

drivers/net/ethernet/lantiq_etop.c: In function 'ltq_etop_hw_init':
drivers/net/ethernet/lantiq_etop.c:273:4: warning: ignoring return value of 'request_irq', declared with attribute warn_unused_result [-Wunused-result]
  273 |    request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/lantiq_etop.c:281:4: warning: ignoring return value of 'request_irq', declared with attribute warn_unused_result [-Wunused-result]
  281 |    request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 drivers/net/ethernet/lantiq_etop.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 2d0c52f7106b..960494f9752b 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -264,13 +264,18 @@ ltq_etop_hw_init(struct net_device *dev)
 	for (i = 0; i < MAX_DMA_CHAN; i++) {
 		int irq = LTQ_DMA_CH0_INT + i;
 		struct ltq_etop_chan *ch = &priv->ch[i];
+		int ret;
 
 		ch->idx = ch->dma.nr = i;
 		ch->dma.dev = &priv->pdev->dev;
 
 		if (IS_TX(i)) {
 			ltq_dma_alloc_tx(&ch->dma);
-			request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv);
+			ret = request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv);
+			if (ret) {
+				netdev_err(dev, "failed to request irq\n");
+				return ret;
+			}
 		} else if (IS_RX(i)) {
 			ltq_dma_alloc_rx(&ch->dma);
 			for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM;
@@ -278,7 +283,11 @@ ltq_etop_hw_init(struct net_device *dev)
 				if (ltq_etop_alloc_skb(ch))
 					return -ENOMEM;
 			ch->dma.desc = 0;
-			request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv);
+			ret = request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv);
+			if (ret) {
+				netdev_err(dev, "failed to request irq\n");
+				return ret;
+			}
 		}
 		ch->dma.irq = irq;
 	}
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-21 23:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-21  5:43 [PATCH] net: lantiq_etop: check the result of request_irq() Masahiro Yamada
2020-12-21 15:26 ` Andrew Lunn
2020-12-21 15:59   ` Masahiro Yamada
2020-12-21 17:01     ` Andrew Lunn
2020-12-21 17:38       ` Miguel Ojeda
2020-12-21 18:04     ` Andrew Lunn
2020-12-21 23:41       ` Hauke Mehrtens

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