2017-06-06 10:18:13

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] watchdog: davinci: Handle return value of clk_prepare_enable

clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/watchdog/davinci_wdt.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 0e731d7..1ba9ead 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -173,7 +173,11 @@ static int davinci_wdt_probe(struct platform_device *pdev)
return PTR_ERR(davinci_wdt->clk);
}

- clk_prepare_enable(davinci_wdt->clk);
+ ret = clk_prepare_enable(davinci_wdt->clk);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to prepare clock\n");
+ return ret;
+ }

platform_set_drvdata(pdev, davinci_wdt);

--
1.9.1


2017-06-07 20:49:10

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] watchdog: davinci: Handle return value of clk_prepare_enable

On Tue, Jun 06, 2017 at 03:47:53PM +0530, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/watchdog/davinci_wdt.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> index 0e731d7..1ba9ead 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -173,7 +173,11 @@ static int davinci_wdt_probe(struct platform_device *pdev)
> return PTR_ERR(davinci_wdt->clk);
> }
>
> - clk_prepare_enable(davinci_wdt->clk);
> + ret = clk_prepare_enable(davinci_wdt->clk);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to prepare clock\n");
> + return ret;
> + }
>
> platform_set_drvdata(pdev, davinci_wdt);
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html