[2/2] clk: sprd: Add check for return value of sprd_clk_regmap_init()

Message ID 20190521060952.2949-3-zhang.chunyan@linaro.org
State Superseded
Headers show
Series
  • Return immediately if sprd_clk_regmap_init() fails
Related show

Commit Message

Chunyan Zhang May 21, 2019, 6:09 a.m.
sprd_clk_regmap_init() doesn't always return success, adding check
for its return value should make the code more strong.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>

---
 drivers/clk/sprd/sc9860-clk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.17.1

Comments

(Exiting) Baolin Wang May 21, 2019, 6:38 a.m. | #1
On Tue, 21 May 2019 at 14:15, Chunyan Zhang <zhang.chunyan@linaro.org> wrote:
>

> sprd_clk_regmap_init() doesn't always return success, adding check

> for its return value should make the code more strong.

>

> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>


Reviewed-by: Baolin Wang <baolin.wang@linaro.org>


> ---

>  drivers/clk/sprd/sc9860-clk.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

>

> diff --git a/drivers/clk/sprd/sc9860-clk.c b/drivers/clk/sprd/sc9860-clk.c

> index 9980ab55271b..1ed45b4f2fe8 100644

> --- a/drivers/clk/sprd/sc9860-clk.c

> +++ b/drivers/clk/sprd/sc9860-clk.c

> @@ -2031,7 +2031,9 @@ static int sc9860_clk_probe(struct platform_device *pdev)

>         }

>

>         desc = match->data;

> -       sprd_clk_regmap_init(pdev, desc);

> +       ret = sprd_clk_regmap_init(pdev, desc);

> +       if (ret)

> +               return ret;

>

>         return sprd_clk_probe(&pdev->dev, desc->hw_clks);

>  }

> --

> 2.17.1

>



-- 
Baolin Wang
Best Regards

Patch

diff --git a/drivers/clk/sprd/sc9860-clk.c b/drivers/clk/sprd/sc9860-clk.c
index 9980ab55271b..1ed45b4f2fe8 100644
--- a/drivers/clk/sprd/sc9860-clk.c
+++ b/drivers/clk/sprd/sc9860-clk.c
@@ -2031,7 +2031,9 @@  static int sc9860_clk_probe(struct platform_device *pdev)
 	}
 
 	desc = match->data;
-	sprd_clk_regmap_init(pdev, desc);
+	ret = sprd_clk_regmap_init(pdev, desc);
+	if (ret)
+		return ret;
 
 	return sprd_clk_probe(&pdev->dev, desc->hw_clks);
 }