* [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe
@ 2022-04-07 9:18 Krzysztof Kozlowski
2022-04-07 9:18 ` [RESEND PATCH 2/2] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Krzysztof Kozlowski
2022-04-11 17:16 ` [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe Vinod Koul
0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-07 9:18 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vinod Koul, Krzysztof Kozlowski,
Alim Akhtar, Girish K S, Yuvaraj Kumar C D, Vasanth Ananthan,
linux-phy, linux-arm-kernel, linux-samsung-soc, linux-kernel
Cc: Miaoqian Lin
From: Miaoqian Lin <linmq006@gmail.com>
The device_node pointer is returned by of_parse_phandle() with refcount
incremented. We should use of_node_put() on it when done.
Fixes: bcff4cba41bc ("PHY: Exynos: Add Exynos5250 SATA PHY driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/phy/samsung/phy-exynos5250-sata.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/samsung/phy-exynos5250-sata.c b/drivers/phy/samsung/phy-exynos5250-sata.c
index 9ec234243f7c..6c305a3fe187 100644
--- a/drivers/phy/samsung/phy-exynos5250-sata.c
+++ b/drivers/phy/samsung/phy-exynos5250-sata.c
@@ -187,6 +187,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
return -EINVAL;
sata_phy->client = of_find_i2c_device_by_node(node);
+ of_node_put(node);
if (!sata_phy->client)
return -EPROBE_DEFER;
--
2.32.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 4+ messages in thread* [RESEND PATCH 2/2] phy: samsung: exynos5250-sata: fix missing device put in probe error paths 2022-04-07 9:18 [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe Krzysztof Kozlowski @ 2022-04-07 9:18 ` Krzysztof Kozlowski 2022-04-07 9:19 ` Krzysztof Kozlowski 2022-04-11 17:16 ` [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe Vinod Koul 1 sibling, 1 reply; 4+ messages in thread From: Krzysztof Kozlowski @ 2022-04-07 9:18 UTC (permalink / raw) To: Kishon Vijay Abraham I, Vinod Koul, Krzysztof Kozlowski, Alim Akhtar, Girish K S, Yuvaraj Kumar C D, Vasanth Ananthan, linux-phy, linux-arm-kernel, linux-samsung-soc, linux-kernel 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@linaro.org> --- 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 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RESEND PATCH 2/2] phy: samsung: exynos5250-sata: fix missing device put in probe error paths 2022-04-07 9:18 ` [RESEND PATCH 2/2] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Krzysztof Kozlowski @ 2022-04-07 9:19 ` Krzysztof Kozlowski 0 siblings, 0 replies; 4+ messages in thread From: Krzysztof Kozlowski @ 2022-04-07 9:19 UTC (permalink / raw) To: Kishon Vijay Abraham I, Vinod Koul, Alim Akhtar, Girish K S, Yuvaraj Kumar C D, Vasanth Ananthan, linux-phy, linux-arm-kernel, linux-samsung-soc, linux-kernel On 07/04/2022 11:18, Krzysztof Kozlowski wrote: > 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@linaro.org> > --- > drivers/phy/samsung/phy-exynos5250-sata.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) I forgot: Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> https://lore.kernel.org/all/018501d834eb$01e62ad0$05b28070$@samsung.com/ Best regards, Krzysztof -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe 2022-04-07 9:18 [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe Krzysztof Kozlowski 2022-04-07 9:18 ` [RESEND PATCH 2/2] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Krzysztof Kozlowski @ 2022-04-11 17:16 ` Vinod Koul 1 sibling, 0 replies; 4+ messages in thread From: Vinod Koul @ 2022-04-11 17:16 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Kishon Vijay Abraham I, Alim Akhtar, Girish K S, Yuvaraj Kumar C D, Vasanth Ananthan, linux-phy, linux-arm-kernel, linux-samsung-soc, linux-kernel, Miaoqian Lin On 07-04-22, 11:18, Krzysztof Kozlowski wrote: > From: Miaoqian Lin <linmq006@gmail.com> > > The device_node pointer is returned by of_parse_phandle() with refcount > incremented. We should use of_node_put() on it when done. Applied all, thanks -- ~Vinod -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-11 17:16 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-04-07 9:18 [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe Krzysztof Kozlowski 2022-04-07 9:18 ` [RESEND PATCH 2/2] phy: samsung: exynos5250-sata: fix missing device put in probe error paths Krzysztof Kozlowski 2022-04-07 9:19 ` Krzysztof Kozlowski 2022-04-11 17:16 ` [RESEND PATCH 1/2] phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe Vinod Koul
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox