diff mbox series

mmc: renesas_sdhi: Use devm_clk_get_optional() to obtain CD clock

Message ID 540d803d31bf9aa1d0f78f431cae0ccd05387edc.1637069733.git.geert+renesas@glider.be (mailing list archive)
State New, archived
Headers show
Series mmc: renesas_sdhi: Use devm_clk_get_optional() to obtain CD clock | expand

Commit Message

Geert Uytterhoeven Nov. 16, 2021, 1:36 p.m. UTC
Use the existing devm_clk_get_optional() helper to obtain the optional
Card Detect clock, instead of open-coding the same operation.
a side effect, real errors will now be handled correctly instead of
being ignored.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/mmc/host/renesas_sdhi_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Wolfram Sang Nov. 16, 2021, 7:27 p.m. UTC | #1
On Tue, Nov 16, 2021 at 02:36:07PM +0100, Geert Uytterhoeven wrote:
> Use the existing devm_clk_get_optional() helper to obtain the optional
> Card Detect clock, instead of open-coding the same operation.
> a side effect, real errors will now be handled correctly instead of
> being ignored.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks, Geert!
Ulf Hansson Nov. 22, 2021, 11:25 a.m. UTC | #2
On Tue, 16 Nov 2021 at 14:36, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> Use the existing devm_clk_get_optional() helper to obtain the optional
> Card Detect clock, instead of open-coding the same operation.
> a side effect, real errors will now be handled correctly instead of
> being ignored.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

I guess it's best if you continue to funnel renesas_sdhi changes
through your tree for the current cycle, to avoid conflicts. Right?

Kind regards
Uffe

> ---
>  drivers/mmc/host/renesas_sdhi_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index a6c47362035a0415..f41225a34f4ae863 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -936,9 +936,9 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>          * to the card detect circuit. That leaves us with if separate clocks
>          * are presented, we must treat them both as virtually 1 clock.
>          */
> -       priv->clk_cd = devm_clk_get(&pdev->dev, "cd");
> +       priv->clk_cd = devm_clk_get_optional(&pdev->dev, "cd");
>         if (IS_ERR(priv->clk_cd))
> -               priv->clk_cd = NULL;
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk_cd), "cannot get cd clock");
>
>         priv->pinctrl = devm_pinctrl_get(&pdev->dev);
>         if (!IS_ERR(priv->pinctrl)) {
> --
> 2.25.1
>
Geert Uytterhoeven Nov. 23, 2021, 9:31 a.m. UTC | #3
Hi Ulf,

On Mon, Nov 22, 2021 at 12:26 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Tue, 16 Nov 2021 at 14:36, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> >
> > Use the existing devm_clk_get_optional() helper to obtain the optional
> > Card Detect clock, instead of open-coding the same operation.
> > a side effect, real errors will now be handled correctly instead of
> > being ignored.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Thanks!

> I guess it's best if you continue to funnel renesas_sdhi changes
> through your tree for the current cycle, to avoid conflicts. Right?

Sure, will queue in renesas-clk-for-v5.17.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox series

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index a6c47362035a0415..f41225a34f4ae863 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -936,9 +936,9 @@  int renesas_sdhi_probe(struct platform_device *pdev,
 	 * to the card detect circuit. That leaves us with if separate clocks
 	 * are presented, we must treat them both as virtually 1 clock.
 	 */
-	priv->clk_cd = devm_clk_get(&pdev->dev, "cd");
+	priv->clk_cd = devm_clk_get_optional(&pdev->dev, "cd");
 	if (IS_ERR(priv->clk_cd))
-		priv->clk_cd = NULL;
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk_cd), "cannot get cd clock");
 
 	priv->pinctrl = devm_pinctrl_get(&pdev->dev);
 	if (!IS_ERR(priv->pinctrl)) {