45d850857feb71dba9a7b9c807801ae7c9725414
[openwrt.git] / target / linux / lantiq / patches-3.2 / 0021-NET-MIPS-lantiq-return-value-of-request_irq-was-not-.patch
1 From 6916ef9742e45213d524b69700d937976098d1e6 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Tue, 15 Nov 2011 15:56:06 +0100
4 Subject: [PATCH 21/70] NET: MIPS: lantiq: return value of request_irq was not
5  handled gracefully
6
7 The return values of request_irq() were not checked leading to the following
8 error message.
9
10 drivers/net/ethernet/lantiq_etop.c: In function 'ltq_etop_hw_init':
11 drivers/net/ethernet/lantiq_etop.c:368:15: warning: ignoring return value of 'request_irq', declared with attribute warn_unused_result
12 drivers/net/ethernet/lantiq_etop.c:377:15: warning: ignoring return value of 'request_irq', declared with attribute warn_unused_result
13
14 Signed-off-by: John Crispin <blogic@openwrt.org>
15 Cc: netdev@vger.kernel.org
16 ---
17  drivers/net/ethernet/lantiq_etop.c |   14 ++++++++------
18  1 files changed, 8 insertions(+), 6 deletions(-)
19
20 --- a/drivers/net/ethernet/lantiq_etop.c
21 +++ b/drivers/net/ethernet/lantiq_etop.c
22 @@ -312,6 +312,7 @@ ltq_etop_hw_init(struct net_device *dev)
23  {
24         struct ltq_etop_priv *priv = netdev_priv(dev);
25         unsigned int mii_mode = priv->pldata->mii_mode;
26 +       int err = 0;
27         int i;
28  
29         ltq_pmu_enable(PMU_PPE);
30 @@ -356,7 +357,7 @@ ltq_etop_hw_init(struct net_device *dev)
31  
32         ltq_dma_init_port(DMA_PORT_ETOP);
33  
34 -       for (i = 0; i < MAX_DMA_CHAN; i++) {
35 +       for (i = 0; i < MAX_DMA_CHAN && !err; i++) {
36                 int irq = LTQ_DMA_ETOP + i;
37                 struct ltq_etop_chan *ch = &priv->ch[i];
38  
39 @@ -364,21 +365,22 @@ ltq_etop_hw_init(struct net_device *dev)
40  
41                 if (IS_TX(i)) {
42                         ltq_dma_alloc_tx(&ch->dma);
43 -                       request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
44 +                       err = request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
45                                 "etop_tx", priv);
46                 } else if (IS_RX(i)) {
47                         ltq_dma_alloc_rx(&ch->dma);
48                         for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM;
49                                         ch->dma.desc++)
50                                 if (ltq_etop_alloc_skb(ch))
51 -                                       return -ENOMEM;
52 +                                       err = -ENOMEM;
53                         ch->dma.desc = 0;
54 -                       request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
55 +                       err = request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
56                                 "etop_rx", priv);
57                 }
58 -               ch->dma.irq = irq;
59 +               if (!err)
60 +                       ch->dma.irq = irq;
61         }
62 -       return 0;
63 +       return err;
64  }
65  
66  static void