netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Andre.Edich@microchip.com>
To: <netdev@vger.kernel.org>, <UNGLinuxDriver@microchip.com>,
	<steve.glendinning@shawell.net>
Cc: <Parthiban.Veerasooran@microchip.com>
Subject: [PATCH net-next 1/8] smsc95xx: check return value of smsc95xx_reset
Date: Mon, 29 Jun 2020 13:10:47 +0000	[thread overview]
Message-ID: <07d84bc9ea8a7282b790795ca3ebfc0c7d63447d.camel@microchip.com> (raw)

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)

             reply	other threads:[~2020-06-29 19:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 13:10 Andre.Edich [this message]
2020-06-30  1:08 ` [PATCH net-next 1/8] smsc95xx: check return value of smsc95xx_reset Andrew Lunn
2020-06-29 20:15 Andre.Edich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07d84bc9ea8a7282b790795ca3ebfc0c7d63447d.camel@microchip.com \
    --to=andre.edich@microchip.com \
    --cc=Parthiban.Veerasooran@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=netdev@vger.kernel.org \
    --cc=steve.glendinning@shawell.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).