can: Fix possible NULL pointer dereference in ems_usb.c
[linux-2.6-block.git] / drivers / net / ksz884x.c
index 0f59099ee72f8d504d314ef41af592d377f58795..0606a1f359fb8a2c2d1ca47fe6907565ce3e489c 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/if_vlan.h>
 #include <linux/crc32.h>
 #include <linux/sched.h>
+#include <linux/slab.h>
 
 
 /* DMA Registers */
@@ -6322,7 +6323,7 @@ static int netdev_set_eeprom(struct net_device *dev,
        int len;
 
        if (eeprom->magic != EEPROM_MAGIC)
-               return 1;
+               return -EINVAL;
 
        len = (eeprom->offset + eeprom->len + 1) / 2;
        for (i = eeprom->offset / 2; i < len; i++)