summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6656
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-08-10 08:00:12 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-31 11:35:06 -0700
commite3a92cdedf3584e20e13511aab252a82d715f927 (patch)
treee3c1de974f9af9cb9d1c732637829c7c2612bb63 /drivers/staging/vt6656
parentfe149785a468e15fb6583a6acf9c4bb28324efbd (diff)
Staging: vt6656: problems in error handling
The first kfree(pDevice) is pointless because pDevice is NULL. The second kfree(pDevice) is a double free because pDevice is the driver's private data and that is already freed by free_netdev(netdev). Also the free_netdev() error path doesn't call usb_put_dev(). Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r--drivers/staging/vt6656/main_usb.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 3a58214c2744..e992d5d9e15b 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -770,10 +770,9 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
udev = usb_get_dev(udev);
netdev = alloc_etherdev(sizeof(DEVICE_INFO));
-
if (!netdev) {
printk(KERN_ERR DEVICE_NAME ": allocate net device failed\n");
- kfree(pDevice);
+ rc = -ENOMEM;
goto err_nomem;
}
@@ -799,9 +798,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
rc = register_netdev(netdev);
if (rc) {
printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n");
- free_netdev(netdev);
- kfree(pDevice);
- return -ENODEV;
+ goto err_netdev;
}
usb_device_reset(pDevice);
@@ -819,10 +816,12 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
return 0;
+err_netdev:
+ free_netdev(netdev);
err_nomem:
usb_put_dev(udev);
- return -ENOMEM;
+ return rc;
}
static void device_free_tx_bufs(PSDevice pDevice)