Skip to content

Commit

Permalink
phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit f7eedcb ]

Add an error handling path in the probe to release some resources, as
already done in the remove function.

Fixes: 609adde ("phy: Add a driver for dm816x USB PHY")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/ac5136881f6bdec50be19b3bf73b3bc1b15ef1f1.1622898974.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and gregkh committed Jul 14, 2021
1 parent a6c7075 commit 21c0574
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions drivers/phy/ti/phy-dm816x-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,28 @@ static int dm816x_usb_phy_probe(struct platform_device *pdev)

pm_runtime_enable(phy->dev);
generic_phy = devm_phy_create(phy->dev, NULL, &ops);
if (IS_ERR(generic_phy))
return PTR_ERR(generic_phy);
if (IS_ERR(generic_phy)) {
error = PTR_ERR(generic_phy);
goto clk_unprepare;
}

phy_set_drvdata(generic_phy, phy);

phy_provider = devm_of_phy_provider_register(phy->dev,
of_phy_simple_xlate);
if (IS_ERR(phy_provider))
return PTR_ERR(phy_provider);
if (IS_ERR(phy_provider)) {
error = PTR_ERR(phy_provider);
goto clk_unprepare;
}

usb_add_phy_dev(&phy->phy);

return 0;

clk_unprepare:
pm_runtime_disable(phy->dev);
clk_unprepare(phy->refclk);
return error;
}

static int dm816x_usb_phy_remove(struct platform_device *pdev)
Expand Down

0 comments on commit 21c0574

Please sign in to comment.