netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Changzhong <zhangchangzhong@huawei.com>
To: <hauke@hauke-m.de>, <andrew@lunn.ch>, <vivien.didelot@gmail.com>,
	<f.fainelli@gmail.com>, <olteanv@gmail.com>,
	<davem@davemloft.net>, <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH net] net: dsa: lantiq_gswip: add missed clk_disable_unprepare() in gswip_gphy_fw_load()
Date: Thu, 12 Nov 2020 19:11:35 +0800	[thread overview]
Message-ID: <1605179495-818-1-git-send-email-zhangchangzhong@huawei.com> (raw)

Fix missing clk_disable_unprepare() before return from
gswip_gphy_fw_load() in the error handling case.

Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/dsa/lantiq_gswip.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 74db81d..8936d65 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -1682,6 +1682,7 @@ static int gswip_gphy_fw_load(struct gswip_priv *priv, struct gswip_gphy_fw *gph
 	if (ret) {
 		dev_err(dev, "failed to load firmware: %s, error: %i\n",
 			gphy_fw->fw_name, ret);
+		clk_disable_unprepare(gphy_fw->clk_gate);
 		return ret;
 	}
 
@@ -1698,14 +1699,17 @@ static int gswip_gphy_fw_load(struct gswip_priv *priv, struct gswip_gphy_fw *gph
 	} else {
 		dev_err(dev, "failed to alloc firmware memory\n");
 		release_firmware(fw);
+		clk_disable_unprepare(gphy_fw->clk_gate);
 		return -ENOMEM;
 	}
 
 	release_firmware(fw);
 
 	ret = regmap_write(priv->rcu_regmap, gphy_fw->fw_addr_offset, dev_addr);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(gphy_fw->clk_gate);
 		return ret;
+	}
 
 	reset_control_deassert(gphy_fw->reset);
 
-- 
2.9.5


             reply	other threads:[~2020-11-12 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 11:11 Zhang Changzhong [this message]
2020-11-12 12:41 ` [PATCH net] net: dsa: lantiq_gswip: add missed clk_disable_unprepare() in gswip_gphy_fw_load() Vladimir Oltean
2020-11-13  2:34   ` Zhang Changzhong

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=1605179495-818-1-git-send-email-zhangchangzhong@huawei.com \
    --to=zhangchangzhong@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.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).