[v2,2/3] clk: sprd: Check error only for devm_regmap_init_mmio()

Message ID 20190522011504.19342-3-zhang.chunyan@linaro.org
State Accepted
Commit 78f529695182b980a5183b850fe2d87091e36874
Headers show
Series
  • Return immediately if sprd_clk_regmap_init() fails
Related show

Commit Message

Chunyan Zhang May 22, 2019, 1:15 a.m.
The function devm_regmap_init_mmio() wouldn't return NULL pointer for
now, so only need to ensure the return value is not an error code.

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

---
 drivers/clk/sprd/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1

Comments

(Exiting) Baolin Wang May 22, 2019, 2:08 a.m. | #1
On Wed, 22 May 2019 at 09:15, Chunyan Zhang <zhang.chunyan@linaro.org> wrote:
>

> The function devm_regmap_init_mmio() wouldn't return NULL pointer for

> now, so only need to ensure the return value is not an error code.

>

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


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


> ---

>  drivers/clk/sprd/common.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

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

> index 9ce690999eaa..a5bdca1de5d0 100644

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

> +++ b/drivers/clk/sprd/common.c

> @@ -58,7 +58,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,

>

>                 regmap = devm_regmap_init_mmio(&pdev->dev, base,

>                                                &sprdclk_regmap_config);

> -               if (IS_ERR_OR_NULL(regmap)) {

> +               if (IS_ERR(regmap)) {

>                         pr_err("failed to init regmap\n");

>                         return PTR_ERR(regmap);

>                 }

> --

> 2.17.1

>



-- 
Baolin Wang
Best Regards
Stephen Boyd June 26, 2019, 6:16 p.m. | #2
Quoting Chunyan Zhang (2019-05-21 18:15:02)
> The function devm_regmap_init_mmio() wouldn't return NULL pointer for

> now, so only need to ensure the return value is not an error code.

> 

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

> ---


Applied to clk-next

Patch

diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c
index 9ce690999eaa..a5bdca1de5d0 100644
--- a/drivers/clk/sprd/common.c
+++ b/drivers/clk/sprd/common.c
@@ -58,7 +58,7 @@  int sprd_clk_regmap_init(struct platform_device *pdev,
 
 		regmap = devm_regmap_init_mmio(&pdev->dev, base,
 					       &sprdclk_regmap_config);
-		if (IS_ERR_OR_NULL(regmap)) {
+		if (IS_ERR(regmap)) {
 			pr_err("failed to init regmap\n");
 			return PTR_ERR(regmap);
 		}