Skip to content

Commit 5c8402c

Browse files
krzkvinodkoul
authored andcommitted
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: bcff4cb ("PHY: Exynos: Add Exynos5250 SATA PHY driver") Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 388ec8f commit 5c8402c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/phy/samsung/phy-exynos5250-sata.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,32 +196,40 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
196196
sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl");
197197
if (IS_ERR(sata_phy->phyclk)) {
198198
dev_err(dev, "failed to get clk for PHY\n");
199-
return PTR_ERR(sata_phy->phyclk);
199+
ret = PTR_ERR(sata_phy->phyclk);
200+
goto put_dev;
200201
}
201202

202203
ret = clk_prepare_enable(sata_phy->phyclk);
203204
if (ret < 0) {
204205
dev_err(dev, "failed to enable source clk\n");
205-
return ret;
206+
goto put_dev;
206207
}
207208

208209
sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops);
209210
if (IS_ERR(sata_phy->phy)) {
210-
clk_disable_unprepare(sata_phy->phyclk);
211211
dev_err(dev, "failed to create PHY\n");
212-
return PTR_ERR(sata_phy->phy);
212+
ret = PTR_ERR(sata_phy->phy);
213+
goto clk_disable;
213214
}
214215

215216
phy_set_drvdata(sata_phy->phy, sata_phy);
216217

217218
phy_provider = devm_of_phy_provider_register(dev,
218219
of_phy_simple_xlate);
219220
if (IS_ERR(phy_provider)) {
220-
clk_disable_unprepare(sata_phy->phyclk);
221-
return PTR_ERR(phy_provider);
221+
ret = PTR_ERR(phy_provider);
222+
goto clk_disable;
222223
}
223224

224225
return 0;
226+
227+
clk_disable:
228+
clk_disable_unprepare(sata_phy->phyclk);
229+
put_dev:
230+
put_device(&sata_phy->client->dev);
231+
232+
return ret;
225233
}
226234

227235
static const struct of_device_id exynos_sata_phy_of_match[] = {

0 commit comments

Comments
 (0)