* [PATCH net-next 1/8] smsc95xx: check return value of smsc95xx_reset
@ 2020-06-29 13:10 Andre.Edich
2020-06-30 1:08 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Andre.Edich @ 2020-06-29 13:10 UTC (permalink / raw)
To: netdev, UNGLinuxDriver, steve.glendinning; +Cc: Parthiban.Veerasooran
The return value of the function smsc95xx_reset() must be checked
to avoid returning false success from the function smsc95xx_bind().
Signed-off-by: Andre Edich <andre.edich@microchip.com>
Signed-off-by: Parthiban Veerasooran <
Parthiban.Veerasooran@microchip.com>
---
drivers/net/usb/smsc95xx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 3cf4dc3433f9..eb404bb74e18 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1287,6 +1287,8 @@ static int smsc95xx_bind(struct usbnet *dev,
struct usb_interface *intf)
/* Init all registers */
ret = smsc95xx_reset(dev);
+ if (ret)
+ goto free_pdata;
/* detect device revision as different features may be
available */
ret = smsc95xx_read_reg(dev, ID_REV, &val);
@@ -1317,6 +1319,10 @@ static int smsc95xx_bind(struct usbnet *dev,
struct usb_interface *intf)
schedule_delayed_work(&pdata->carrier_check,
CARRIER_CHECK_DELAY);
return 0;
+
+free_pdata:
+ kfree(pdata);
+ return ret;
}
static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface
*intf)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/8] smsc95xx: check return value of smsc95xx_reset
2020-06-29 13:10 [PATCH net-next 1/8] smsc95xx: check return value of smsc95xx_reset Andre.Edich
@ 2020-06-30 1:08 ` Andrew Lunn
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2020-06-30 1:08 UTC (permalink / raw)
To: Andre.Edich
Cc: netdev, UNGLinuxDriver, steve.glendinning, Parthiban.Veerasooran
On Mon, Jun 29, 2020 at 01:10:47PM +0000, Andre.Edich@microchip.com wrote:
> The return value of the function smsc95xx_reset() must be checked
> to avoid returning false success from the function smsc95xx_bind().
Hi Andre
This and the next patch look like fixes. They should be for the net
tree, and have a Fixes: tag added.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next 1/8] smsc95xx: check return value of smsc95xx_reset
@ 2020-06-29 20:15 Andre.Edich
0 siblings, 0 replies; 3+ messages in thread
From: Andre.Edich @ 2020-06-29 20:15 UTC (permalink / raw)
To: netdev, UNGLinuxDriver, steve.glendinning; +Cc: Parthiban.Veerasooran
The return value of the function smsc95xx_reset() must be checked
to avoid returning false success from the function smsc95xx_bind().
Signed-off-by: Andre Edich <andre.edich@microchip.com>
Signed-off-by: Parthiban Veerasooran <
Parthiban.Veerasooran@microchip.com>
---
drivers/net/usb/smsc95xx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 3cf4dc3433f9..eb404bb74e18 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1287,6 +1287,8 @@ static int smsc95xx_bind(struct usbnet *dev,
struct usb_interface *intf)
/* Init all registers */
ret = smsc95xx_reset(dev);
+ if (ret)
+ goto free_pdata;
/* detect device revision as different features may be
available */
ret = smsc95xx_read_reg(dev, ID_REV, &val);
@@ -1317,6 +1319,10 @@ static int smsc95xx_bind(struct usbnet *dev,
struct usb_interface *intf)
schedule_delayed_work(&pdata->carrier_check,
CARRIER_CHECK_DELAY);
return 0;
+
+free_pdata:
+ kfree(pdata);
+ return ret;
}
static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface
*intf)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-30 1:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 13:10 [PATCH net-next 1/8] smsc95xx: check return value of smsc95xx_reset Andre.Edich
2020-06-30 1:08 ` Andrew Lunn
2020-06-29 20:15 Andre.Edich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).