2017-06-01 10:58:29

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] mtd: nand: orion: 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/mtd/nand/orion_nand.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index f8e463a..209170e 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -166,7 +166,11 @@ static int __init orion_nand_probe(struct platform_device *pdev)
}
}

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

ret = nand_scan(mtd, 1);
if (ret)
--
1.9.1


2017-06-07 07:32:46

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH] mtd: nand: orion: Handle return value of clk_prepare_enable

On Thu, 1 Jun 2017 16:28:15 +0530
Arvind Yadav <[email protected]> wrote:

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

Applied.

Thanks,

Boris

> Signed-off-by: Arvind Yadav <[email protected]>
> ---
> drivers/mtd/nand/orion_nand.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
> index f8e463a..209170e 100644
> --- a/drivers/mtd/nand/orion_nand.c
> +++ b/drivers/mtd/nand/orion_nand.c
> @@ -166,7 +166,11 @@ static int __init orion_nand_probe(struct platform_device *pdev)
> }
> }
>
> - clk_prepare_enable(info->clk);
> + ret = clk_prepare_enable(info->clk);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to prepare clock!\n");
> + return ret;
> + }
>
> ret = nand_scan(mtd, 1);
> if (ret)