[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201210080454.17379-1-chris.ruehl@gtsys.com.hk>
Date: Thu, 10 Dec 2020 16:04:54 +0800
From: Chris Ruehl <chris.ruehl@...ys.com.hk>
To: linux-rockchip@...ts.infradead.org
Cc: Kishon Vijay Abraham I <kishon@...com>,
Vinod Koul <vkoul@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
Douglas Anderson <dianders@...omium.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Chris Ruehl <chris.ruehl@...ys.com.hk>
Subject: [PATCH v3] phy: rockchip-emmc: emmc_phy_init() always return 0
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: 52c0624a10cce phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
Signed-off-by: Chris Ruehl <chris.ruehl@...ys.com.hk>
Reviewed-by: Douglas Anderson <dianders@...omium.org>
---
v3 - IS_ERROR() already return false if rk_phy->emmcclk == NULL
add Reviewed tag
v2 - use clk_get_optional
drivers/phy/rockchip/phy-rockchip-emmc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
index 48e2d75b1004..9d8123f7fd07 100644
--- a/drivers/phy/rockchip/phy-rockchip-emmc.c
+++ b/drivers/phy/rockchip/phy-rockchip-emmc.c
@@ -245,15 +245,17 @@ static int rockchip_emmc_phy_init(struct phy *phy)
* - SDHCI driver to get the PHY
* - SDHCI driver to init the PHY
*
- * The clock is optional, so upon any error we just set to NULL.
+ * The clock is optional, using clk_get_optional() to get the clock
+ * and do error processing if the return value != NULL
*
* NOTE: we don't do anything special for EPROBE_DEFER here. Given the
* above expected use case, EPROBE_DEFER isn't sensible to expect, so
* it's just like any other error.
*/
- rk_phy->emmcclk = clk_get(&phy->dev, "emmcclk");
+ rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
if (IS_ERR(rk_phy->emmcclk)) {
- dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
+ ret = PTR_ERR(rk_phy->emmcclk);
+ dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret);
rk_phy->emmcclk = NULL;
}
--
2.20.1
Powered by blists - more mailing lists