Skip to content

Commit 95fdc1e

Browse files
ruehlchrisgregkh
authored andcommitted
phy: rockchip-emmc: emmc_phy_init() always return 0
[ Upstream commit 39961bd ] rockchip_emmc_phy_init() return variable is not set with the error value if clk_get() failed. 'emmcclk' is optional, thus use clk_get_optional() and if the return value != NULL make error processing and set the return code accordingly. Fixes: 52c0624 phy: rockchip-emmc: Set phyctrl_frqsel based on card clock Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk> Reviewed-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20201210080454.17379-1-chris.ruehl@gtsys.com.hk Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 03112ff commit 95fdc1e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/phy/rockchip/phy-rockchip-emmc.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,17 @@ static int rockchip_emmc_phy_init(struct phy *phy)
240240
* - SDHCI driver to get the PHY
241241
* - SDHCI driver to init the PHY
242242
*
243-
* The clock is optional, so upon any error we just set to NULL.
243+
* The clock is optional, using clk_get_optional() to get the clock
244+
* and do error processing if the return value != NULL
244245
*
245246
* NOTE: we don't do anything special for EPROBE_DEFER here. Given the
246247
* above expected use case, EPROBE_DEFER isn't sensible to expect, so
247248
* it's just like any other error.
248249
*/
249-
rk_phy->emmcclk = clk_get(&phy->dev, "emmcclk");
250+
rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
250251
if (IS_ERR(rk_phy->emmcclk)) {
251-
dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
252+
ret = PTR_ERR(rk_phy->emmcclk);
253+
dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret);
252254
rk_phy->emmcclk = NULL;
253255
}
254256

0 commit comments

Comments
 (0)