USB: fix double frees in error code paths of ipaq driver
[cascardo/linux.git] / drivers / net / cris / eth_v10.c
index 64105e4..314b2f6 100644 (file)
  *
  */
 
-#include <linux/config.h>
 
 #include <linux/module.h>
 
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/fcntl.h>
@@ -404,8 +402,8 @@ static int etrax_ethernet_init(void);
 static int e100_open(struct net_device *dev);
 static int e100_set_mac_address(struct net_device *dev, void *addr);
 static int e100_send_packet(struct sk_buff *skb, struct net_device *dev);
-static irqreturn_t e100rxtx_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static irqreturn_t e100nw_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t e100rxtx_interrupt(int irq, void *dev_id);
+static irqreturn_t e100nw_interrupt(int irq, void *dev_id);
 static void e100_rx(struct net_device *dev);
 static int e100_close(struct net_device *dev);
 static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
@@ -435,7 +433,7 @@ static void e100_reset_transceiver(struct net_device* net);
 static void e100_clear_network_leds(unsigned long dummy);
 static void e100_set_network_leds(int active);
 
-static struct ethtool_ops e100_ethtool_ops;
+static const struct ethtool_ops e100_ethtool_ops;
 
 static void broadcom_check_speed(struct net_device* dev);
 static void broadcom_check_duplex(struct net_device* dev);
@@ -510,6 +508,8 @@ etrax_ethernet_init(void)
                 * does not share cacheline with any other data (to avoid cache bug)
                 */
                RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES);
+               if (!RxDescList[i].skb)
+                       return -ENOMEM;
                RxDescList[i].descr.ctrl   = 0;
                RxDescList[i].descr.sw_len = MAX_MEDIA_DATA_SIZE;
                RxDescList[i].descr.next   = virt_to_phys(&RxDescList[i + 1]);
@@ -618,12 +618,8 @@ e100_set_mac_address(struct net_device *dev, void *p)
 
        /* show it in the log as well */
 
-       printk(KERN_INFO "%s: changed MAC to ", dev->name);
-
-       for (i = 0; i < 5; i++)
-               printk("%02X:", dev->dev_addr[i]);
-
-       printk("%02X\n", dev->dev_addr[i]);
+       printk(KERN_INFO "%s: changed MAC to %s\n",
+              dev->name, print_mac(mac, dev->dev_addr));
 
        spin_unlock(&np->lock);
 
@@ -672,7 +668,7 @@ e100_open(struct net_device *dev)
        /* allocate the irq corresponding to the receiving DMA */
 
        if (request_irq(NETWORK_DMA_RX_IRQ_NBR, e100rxtx_interrupt,
-                       SA_SAMPLE_RANDOM, cardname, (void *)dev)) {
+                       IRQF_SAMPLE_RANDOM, cardname, (void *)dev)) {
                goto grace_exit0;
        }
 
@@ -1198,7 +1194,7 @@ e100_send_packet(struct sk_buff *skb, struct net_device *dev)
  */
 
 static irqreturn_t
-e100rxtx_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+e100rxtx_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = (struct net_device *)dev_id;
        struct net_local *np = (struct net_local *)dev->priv;
@@ -1265,7 +1261,7 @@ e100rxtx_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 }
 
 static irqreturn_t
-e100nw_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+e100nw_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = (struct net_device *)dev_id;
        struct net_local *np = (struct net_local *)dev->priv;
@@ -1348,7 +1344,8 @@ e100_rx(struct net_device *dev)
 
 #ifdef ETHDEBUG
                printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n",
-                 skb->head, skb->data, skb->tail, skb->end);
+                      skb->head, skb->data, skb_tail_pointer(skb),
+                      skb_end_pointer(skb));
                printk("copying packet to 0x%x.\n", skb_data_ptr);
 #endif
 
@@ -1375,7 +1372,6 @@ e100_rx(struct net_device *dev)
                myNextRxDesc->descr.buf = L1_CACHE_ALIGN(virt_to_phys(myNextRxDesc->skb->data));
        }
 
-       skb->dev = dev;
        skb->protocol = eth_type_trans(skb, dev);
 
        /* Send the packet to the upper layers */
@@ -1553,7 +1549,7 @@ static int e100_nway_reset(struct net_device *dev)
        return 0;
 }
 
-static struct ethtool_ops e100_ethtool_ops = {
+static const struct ethtool_ops e100_ethtool_ops = {
        .get_settings   = e100_get_settings,
        .set_settings   = e100_set_settings,
        .get_drvinfo    = e100_get_drvinfo,