* [PATCH v2] phy: rockchip-emmc: emmc_phy_init() always return 0
@ 2020-12-09 2:07 ` Chris Ruehl
0 siblings, 0 replies; 6+ messages in thread
From: Chris Ruehl @ 2020-12-09 2:07 UTC (permalink / raw)
To: linux-rockchip
Cc: Kishon Vijay Abraham I, Vinod Koul, Heiko Stuebner,
Douglas Anderson, Ulf Hansson, linux-kernel, linux-arm-kernel,
Chris Ruehl
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@gtsys.com.hk>
---
drivers/phy/rockchip/phy-rockchip-emmc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
index 48e2d75b1004..a23034416481 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");
- if (IS_ERR(rk_phy->emmcclk)) {
- dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
+ rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
+ if (rk_phy->emmcclk && IS_ERR(rk_phy->emmcclk)) {
+ ret = PTR_ERR(rk_phy->emmcclk);
+ dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret);
rk_phy->emmcclk = NULL;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] phy: rockchip-emmc: emmc_phy_init() always return 0
@ 2020-12-09 2:07 ` Chris Ruehl
0 siblings, 0 replies; 6+ messages in thread
From: Chris Ruehl @ 2020-12-09 2:07 UTC (permalink / raw)
To: linux-rockchip
Cc: Ulf Hansson, Chris Ruehl, Heiko Stuebner, linux-kernel,
Douglas Anderson, Vinod Koul, Kishon Vijay Abraham I,
linux-arm-kernel
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@gtsys.com.hk>
---
drivers/phy/rockchip/phy-rockchip-emmc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
index 48e2d75b1004..a23034416481 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");
- if (IS_ERR(rk_phy->emmcclk)) {
- dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
+ rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
+ if (rk_phy->emmcclk && IS_ERR(rk_phy->emmcclk)) {
+ ret = PTR_ERR(rk_phy->emmcclk);
+ dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret);
rk_phy->emmcclk = NULL;
}
--
2.20.1
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] phy: rockchip-emmc: emmc_phy_init() always return 0
@ 2020-12-09 2:07 ` Chris Ruehl
0 siblings, 0 replies; 6+ messages in thread
From: Chris Ruehl @ 2020-12-09 2:07 UTC (permalink / raw)
To: linux-rockchip
Cc: Ulf Hansson, Chris Ruehl, Heiko Stuebner, linux-kernel,
Douglas Anderson, Vinod Koul, Kishon Vijay Abraham I,
linux-arm-kernel
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@gtsys.com.hk>
---
drivers/phy/rockchip/phy-rockchip-emmc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
index 48e2d75b1004..a23034416481 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");
- if (IS_ERR(rk_phy->emmcclk)) {
- dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
+ rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
+ if (rk_phy->emmcclk && IS_ERR(rk_phy->emmcclk)) {
+ ret = PTR_ERR(rk_phy->emmcclk);
+ dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret);
rk_phy->emmcclk = NULL;
}
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: rockchip-emmc: emmc_phy_init() always return 0
2020-12-09 2:07 ` Chris Ruehl
(?)
@ 2020-12-09 17:48 ` Doug Anderson
-1 siblings, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2020-12-09 17:48 UTC (permalink / raw)
To: Chris Ruehl
Cc: open list:ARM/Rockchip SoC...,
Kishon Vijay Abraham I, Vinod Koul, Heiko Stuebner, Ulf Hansson,
LKML, Linux ARM
Hi,
On Tue, Dec 8, 2020 at 6:08 PM Chris Ruehl <chris.ruehl@gtsys.com.hk> wrote:
>
> 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@gtsys.com.hk>
> ---
> drivers/phy/rockchip/phy-rockchip-emmc.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
> index 48e2d75b1004..a23034416481 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");
> - if (IS_ERR(rk_phy->emmcclk)) {
> - dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
> + rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
> + if (rk_phy->emmcclk && IS_ERR(rk_phy->emmcclk)) {
nit: no need to check for "rk_phy->emmcclk". IS_ERR() will return
false for NULL.
Other than that, this looks fine to me.
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: rockchip-emmc: emmc_phy_init() always return 0
@ 2020-12-09 17:48 ` Doug Anderson
0 siblings, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2020-12-09 17:48 UTC (permalink / raw)
To: Chris Ruehl
Cc: Ulf Hansson, Heiko Stuebner, LKML, Kishon Vijay Abraham I,
open list:ARM/Rockchip SoC...,
Vinod Koul, Linux ARM
Hi,
On Tue, Dec 8, 2020 at 6:08 PM Chris Ruehl <chris.ruehl@gtsys.com.hk> wrote:
>
> 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@gtsys.com.hk>
> ---
> drivers/phy/rockchip/phy-rockchip-emmc.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
> index 48e2d75b1004..a23034416481 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");
> - if (IS_ERR(rk_phy->emmcclk)) {
> - dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
> + rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
> + if (rk_phy->emmcclk && IS_ERR(rk_phy->emmcclk)) {
nit: no need to check for "rk_phy->emmcclk". IS_ERR() will return
false for NULL.
Other than that, this looks fine to me.
Reviewed-by: Douglas Anderson <dianders@chromium.org>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: rockchip-emmc: emmc_phy_init() always return 0
@ 2020-12-09 17:48 ` Doug Anderson
0 siblings, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2020-12-09 17:48 UTC (permalink / raw)
To: Chris Ruehl
Cc: Ulf Hansson, Heiko Stuebner, LKML, Kishon Vijay Abraham I,
open list:ARM/Rockchip SoC...,
Vinod Koul, Linux ARM
Hi,
On Tue, Dec 8, 2020 at 6:08 PM Chris Ruehl <chris.ruehl@gtsys.com.hk> wrote:
>
> 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@gtsys.com.hk>
> ---
> drivers/phy/rockchip/phy-rockchip-emmc.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
> index 48e2d75b1004..a23034416481 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");
> - if (IS_ERR(rk_phy->emmcclk)) {
> - dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret);
> + rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk");
> + if (rk_phy->emmcclk && IS_ERR(rk_phy->emmcclk)) {
nit: no need to check for "rk_phy->emmcclk". IS_ERR() will return
false for NULL.
Other than that, this looks fine to me.
Reviewed-by: Douglas Anderson <dianders@chromium.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-12-09 17:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 2:07 [PATCH v2] phy: rockchip-emmc: emmc_phy_init() always return 0 Chris Ruehl
2020-12-09 2:07 ` Chris Ruehl
2020-12-09 2:07 ` Chris Ruehl
2020-12-09 17:48 ` Doug Anderson
2020-12-09 17:48 ` Doug Anderson
2020-12-09 17:48 ` Doug Anderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.