irda: via-ircc proper dma freeing
authorWang Chen <wangchen@cn.fujitsu.com>
Tue, 8 Jul 2008 10:06:46 +0000 (03:06 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jul 2008 10:06:46 +0000 (03:06 -0700)
1. dma should be freed when dma2 request fail.
2. dma2 should be freed too when device close.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/irda/via-ircc.c

index 58e128784585a41b9c80410eaf46500e40a337ba..04ad3573b15993e3ae8bc1f7521ad6ac3dbae5de 100644 (file)
@@ -1546,6 +1546,7 @@ static int via_ircc_net_open(struct net_device *dev)
                        IRDA_WARNING("%s, unable to allocate dma2=%d\n",
                                     driver_name, self->io.dma2);
                        free_irq(self->io.irq, self);
+                       free_dma(self->io.dma);
                        return -EAGAIN;
                }
        }
@@ -1606,6 +1607,8 @@ static int via_ircc_net_close(struct net_device *dev)
        EnAllInt(iobase, OFF);
        free_irq(self->io.irq, dev);
        free_dma(self->io.dma);
+       if (self->io.dma2 != self->io.dma)
+               free_dma(self->io.dma2);
 
        return 0;
 }