Commit 2294ca7a authored by David S. Miller's avatar David S. Miller

Merge branch 'smsc95xx-fix-smsc95xx_bind'

Andre Edich says:

====================
smsc95xx: fix smsc95xx_bind

The patchset fixes two problems in the function smsc95xx_bind:
 - return of false success
 - memory leak

Changes in v2:
- added "Fixes" tags to both patches
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9dc829a1 3ed58f96
...@@ -1287,11 +1287,14 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -1287,11 +1287,14 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
/* Init all registers */ /* Init all registers */
ret = smsc95xx_reset(dev); ret = smsc95xx_reset(dev);
if (ret)
goto free_pdata;
/* detect device revision as different features may be available */ /* detect device revision as different features may be available */
ret = smsc95xx_read_reg(dev, ID_REV, &val); ret = smsc95xx_read_reg(dev, ID_REV, &val);
if (ret < 0) if (ret < 0)
return ret; goto free_pdata;
val >>= 16; val >>= 16;
pdata->chip_id = val; pdata->chip_id = val;
pdata->mdix_ctrl = get_mdix_status(dev->net); pdata->mdix_ctrl = get_mdix_status(dev->net);
...@@ -1317,6 +1320,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -1317,6 +1320,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY); schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY);
return 0; return 0;
free_pdata:
kfree(pdata);
return ret;
} }
static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment