linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Quentin Schulz <quentin.schulz@bootlin.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH net-next 2/2] net: phy: mscc: fix memory leak in vsc8574_config_pre_init
Date: Tue, 9 Oct 2018 21:39:53 +0200	[thread overview]
Message-ID: <a7a293b1566cb37ecc873d9b186d87656d3766dc.1539113472.git.gustavo@embeddedor.com> (raw)
In-Reply-To: <cover.1539113472.git.gustavo@embeddedor.com>

In case memory resources for *fw* were successfully allocated,
release them before return.

Addresses-Coverity-ID: 1473968 ("Resource leak")
Fixes: 00d70d8e0e78 ("net: phy: mscc: add support for VSC8574 PHY")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/phy/mscc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index bff56c3..af9fb2d 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -1292,7 +1292,7 @@ static int vsc8574_config_pre_init(struct phy_device *phydev)
 				dev_err(dev,
 					"%s: failed to assert reset of micro\n",
 					__func__);
-				return ret;
+				goto release_fw;
 			}
 		}
 	} else {
@@ -1338,7 +1338,7 @@ static int vsc8574_config_pre_init(struct phy_device *phydev)
 
 out:
 	phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_STANDARD);
-
+release_fw:
 	release_firmware(fw);
 
 	return ret;
-- 
2.7.4


  parent reply	other threads:[~2018-10-09 19:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 19:38 [PATCH net-next 0/2] fix signedness bug and memory leak in mscc driver Gustavo A. R. Silva
2018-10-09 19:38 ` [PATCH net-next 1/2] net: phy: mscc: fix signedness bug in vsc85xx_downshift_get Gustavo A. R. Silva
2018-10-10  6:56   ` Quentin Schulz
2018-10-09 19:39 ` Gustavo A. R. Silva [this message]
2018-10-10  6:49   ` [PATCH net-next 2/2] net: phy: mscc: fix memory leak in vsc8574_config_pre_init Quentin Schulz
2018-10-10  8:27     ` Gustavo A. R. Silva

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=a7a293b1566cb37ecc873d9b186d87656d3766dc.1539113472.git.gustavo@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quentin.schulz@bootlin.com \
    /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).