linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alim Akhtar" <alim.akhtar@samsung.com>
To: "'Krzysztof Kozlowski'" <krzysztof.kozlowski@canonical.com>,
	"'Kishon Vijay Abraham I'" <kishon@ti.com>,
	"'Vinod Koul'" <vkoul@kernel.org>,
	"'Miaoqian Lin'" <linmq006@gmail.com>,
	<linux-phy@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-samsung-soc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] phy: samsung: exynos5250-sata: fix missing device put in probe error paths
Date: Fri, 11 Mar 2022 07:24:53 +0530	[thread overview]
Message-ID: <018501d834eb$01e62ad0$05b28070$@samsung.com> (raw)
In-Reply-To: <20220309170028.51913-1-krzysztof.kozlowski@canonical.com>

Hi Krzysztof

>-----Original Message-----
>From: Krzysztof Kozlowski [mailto:krzysztof.kozlowski@canonical.com]
>Sent: Wednesday, March 9, 2022 10:30 PM
>To: Kishon Vijay Abraham I <kishon@ti.com>; Vinod Koul
><vkoul@kernel.org>; Krzysztof Kozlowski
><krzysztof.kozlowski@canonical.com>; Alim Akhtar
><alim.akhtar@samsung.com>; Miaoqian Lin <linmq006@gmail.com>; linux-
>phy@lists.infradead.org; linux-arm-kernel@lists.infradead.org; linux-
>samsung-soc@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [PATCH] phy: samsung: exynos5250-sata: fix missing device put in
>probe error paths
>
>The actions of of_find_i2c_device_by_node() in probe function should be
>reversed in error paths by putting the reference to obtained device.
>
>Fixes: bcff4cba41bc ("PHY: Exynos: Add Exynos5250 SATA PHY driver")
>Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>
Thanks for fixing this.

Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>

>---
>
>Rebased on top of (although it is independent, no conflicts):
>https://lore.kernel.org/linux-samsung-soc/20220309124856.32632-1-
>linmq006@gmail.com/T/#u
>---
> drivers/phy/samsung/phy-exynos5250-sata.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/phy/samsung/phy-exynos5250-sata.c
>b/drivers/phy/samsung/phy-exynos5250-sata.c
>index 6c305a3fe187..595adba5fb8f 100644
>--- a/drivers/phy/samsung/phy-exynos5250-sata.c
>+++ b/drivers/phy/samsung/phy-exynos5250-sata.c
>@@ -196,20 +196,21 @@ static int exynos_sata_phy_probe(struct
>platform_device *pdev)
> 	sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl");
> 	if (IS_ERR(sata_phy->phyclk)) {
> 		dev_err(dev, "failed to get clk for PHY\n");
>-		return PTR_ERR(sata_phy->phyclk);
>+		ret = PTR_ERR(sata_phy->phyclk);
>+		goto put_dev;
> 	}
>
> 	ret = clk_prepare_enable(sata_phy->phyclk);
> 	if (ret < 0) {
> 		dev_err(dev, "failed to enable source clk\n");
>-		return ret;
>+		goto put_dev;
> 	}
>
> 	sata_phy->phy = devm_phy_create(dev, NULL,
>&exynos_sata_phy_ops);
> 	if (IS_ERR(sata_phy->phy)) {
>-		clk_disable_unprepare(sata_phy->phyclk);
> 		dev_err(dev, "failed to create PHY\n");
>-		return PTR_ERR(sata_phy->phy);
>+		ret = PTR_ERR(sata_phy->phy);
>+		goto clk_disable;
> 	}
>
> 	phy_set_drvdata(sata_phy->phy, sata_phy); @@ -217,11 +218,18
>@@ static int exynos_sata_phy_probe(struct platform_device *pdev)
> 	phy_provider = devm_of_phy_provider_register(dev,
> 					of_phy_simple_xlate);
> 	if (IS_ERR(phy_provider)) {
>-		clk_disable_unprepare(sata_phy->phyclk);
>-		return PTR_ERR(phy_provider);
>+		ret = PTR_ERR(phy_provider);
>+		goto clk_disable;
> 	}
>
> 	return 0;
>+
>+clk_disable:
>+	clk_disable_unprepare(sata_phy->phyclk);
>+put_dev:
>+	put_device(&sata_phy->client->dev);
>+
>+	return ret;
> }
>
> static const struct of_device_id exynos_sata_phy_of_match[] = {
>--
>2.32.0



  reply	other threads:[~2022-03-11  1:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220309170036epcas5p2e6ee56f4c38761868ad9408616c03203@epcas5p2.samsung.com>
2022-03-09 17:00 ` [PATCH] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Krzysztof Kozlowski
2022-03-11  1:54   ` Alim Akhtar [this message]
2022-04-13  9:51   ` Vinod Koul
2022-04-13  9:57     ` Krzysztof Kozlowski

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='018501d834eb$01e62ad0$05b28070$@samsung.com' \
    --to=alim.akhtar@samsung.com \
    --cc=kishon@ti.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linmq006@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.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 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).