All of lore.kernel.org
 help / color / mirror / Atom feed
From: GUO Zihua <guozihua@huawei.com>
To: <vkoul@kernel.org>, <kishon@kernel.org>, <heiko@sntech.de>
Cc: <linux-phy@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-rockchip@lists.infradead.org>, <bivvy.bi@rock-chips.com>
Subject: [PATCH] phy: rockchip: Fix resource leakage in inno_dsidphy_power_on
Date: Sun, 20 Nov 2022 15:13:30 +0800	[thread overview]
Message-ID: <20221120071330.31154-1-guozihua@huawei.com> (raw)

inno->pclk_phy and inno->ref_clk is not unprepared in error path.
pm_runtime should also be put. This patch fix these issues.

This resolves smatch warning:
inno_dsidphy_power_on() warn: 'inno->pclk_phy' from clk_prepare_enable()
	not released on lines: 607.

Fixes: b7535a3bc0ba ("phy/rockchip: Add support for Innosilicon MIPI/LVDS/TTL PHY")
Fixes: f0684c1a8367 ("phy/rockchip: inno-dsidphy: generalize parameter handling")
Signed-off-by: GUO Zihua <guozihua@huawei.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
index 2c5847faff63..20ba716f5dd0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
@@ -604,6 +604,9 @@ static int inno_dsidphy_power_on(struct phy *phy)
 		inno_dsidphy_lvds_mode_enable(inno);
 		break;
 	default:
+		pm_runtime_put_sync(inno->dev);
+		clk_disable_unprepare(inno->ref_clk);
+		clk_disable_unprepare(inno->pclk_phy);
 		return -EINVAL;
 	}
 
-- 
2.17.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: GUO Zihua <guozihua@huawei.com>
To: <vkoul@kernel.org>, <kishon@kernel.org>, <heiko@sntech.de>
Cc: <linux-phy@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-rockchip@lists.infradead.org>, <bivvy.bi@rock-chips.com>
Subject: [PATCH] phy: rockchip: Fix resource leakage in inno_dsidphy_power_on
Date: Sun, 20 Nov 2022 15:13:30 +0800	[thread overview]
Message-ID: <20221120071330.31154-1-guozihua@huawei.com> (raw)

inno->pclk_phy and inno->ref_clk is not unprepared in error path.
pm_runtime should also be put. This patch fix these issues.

This resolves smatch warning:
inno_dsidphy_power_on() warn: 'inno->pclk_phy' from clk_prepare_enable()
	not released on lines: 607.

Fixes: b7535a3bc0ba ("phy/rockchip: Add support for Innosilicon MIPI/LVDS/TTL PHY")
Fixes: f0684c1a8367 ("phy/rockchip: inno-dsidphy: generalize parameter handling")
Signed-off-by: GUO Zihua <guozihua@huawei.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
index 2c5847faff63..20ba716f5dd0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
@@ -604,6 +604,9 @@ static int inno_dsidphy_power_on(struct phy *phy)
 		inno_dsidphy_lvds_mode_enable(inno);
 		break;
 	default:
+		pm_runtime_put_sync(inno->dev);
+		clk_disable_unprepare(inno->ref_clk);
+		clk_disable_unprepare(inno->pclk_phy);
 		return -EINVAL;
 	}
 
-- 
2.17.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: GUO Zihua <guozihua@huawei.com>
To: <vkoul@kernel.org>, <kishon@kernel.org>, <heiko@sntech.de>
Cc: <linux-phy@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-rockchip@lists.infradead.org>, <bivvy.bi@rock-chips.com>
Subject: [PATCH] phy: rockchip: Fix resource leakage in inno_dsidphy_power_on
Date: Sun, 20 Nov 2022 15:13:30 +0800	[thread overview]
Message-ID: <20221120071330.31154-1-guozihua@huawei.com> (raw)

inno->pclk_phy and inno->ref_clk is not unprepared in error path.
pm_runtime should also be put. This patch fix these issues.

This resolves smatch warning:
inno_dsidphy_power_on() warn: 'inno->pclk_phy' from clk_prepare_enable()
	not released on lines: 607.

Fixes: b7535a3bc0ba ("phy/rockchip: Add support for Innosilicon MIPI/LVDS/TTL PHY")
Fixes: f0684c1a8367 ("phy/rockchip: inno-dsidphy: generalize parameter handling")
Signed-off-by: GUO Zihua <guozihua@huawei.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
index 2c5847faff63..20ba716f5dd0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
@@ -604,6 +604,9 @@ static int inno_dsidphy_power_on(struct phy *phy)
 		inno_dsidphy_lvds_mode_enable(inno);
 		break;
 	default:
+		pm_runtime_put_sync(inno->dev);
+		clk_disable_unprepare(inno->ref_clk);
+		clk_disable_unprepare(inno->pclk_phy);
 		return -EINVAL;
 	}
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-11-20  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20  7:13 GUO Zihua [this message]
2022-11-20  7:13 ` [PATCH] phy: rockchip: Fix resource leakage in inno_dsidphy_power_on GUO Zihua
2022-11-20  7:13 ` GUO Zihua

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=20221120071330.31154-1-guozihua@huawei.com \
    --to=guozihua@huawei.com \
    --cc=bivvy.bi@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=kishon@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=vkoul@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.