diff mbox series

thermal: tsens: fix ptr_ret.cocci warnings

Message ID 20180728012537.GA85570@roam (mailing list archive)
State Not Applicable, archived
Headers show
Series thermal: tsens: fix ptr_ret.cocci warnings | expand

Commit Message

Fengguang Wu July 28, 2018, 1:25 a.m. UTC
From: kbuild test robot <fengguang.wu@intel.com>

drivers/thermal/qcom/tsens-common.c:150:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: faa590baf8df ("thermal: tsens: switch from of_iomap() to devm_ioremap_resource()")
CC: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

 tsens-common.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Amit Kucheria July 30, 2018, 6:14 a.m. UTC | #1
On Sat, Jul 28, 2018 at 6:56 AM kbuild test robot
<fengguang.wu@intel.com> wrote:
>
> From: kbuild test robot <fengguang.wu@intel.com>
>
> drivers/thermal/qcom/tsens-common.c:150:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
>
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
>
> Fixes: faa590baf8df ("thermal: tsens: switch from of_iomap() to devm_ioremap_resource()")
> CC: Amit Kucheria <amit.kucheria@linaro.org>
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>


Acked-by: Amit Kucheria <amit.kucheria@linaro.org>

> ---
>
>  tsens-common.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> --- a/drivers/thermal/qcom/tsens-common.c
> +++ b/drivers/thermal/qcom/tsens-common.c
> @@ -147,8 +147,5 @@ int __init init_common(struct tsens_devi
>                 return PTR_ERR(base);
>
>         tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config);
> -       if (IS_ERR(tmdev->map))
> -               return PTR_ERR(tmdev->map);
> -
> -       return 0;
> +       return PTR_ERR_OR_ZERO(tmdev->map);
>  }
diff mbox series

Patch

--- a/drivers/thermal/qcom/tsens-common.c
+++ b/drivers/thermal/qcom/tsens-common.c
@@ -147,8 +147,5 @@  int __init init_common(struct tsens_devi
 		return PTR_ERR(base);
 
 	tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config);
-	if (IS_ERR(tmdev->map))
-		return PTR_ERR(tmdev->map);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(tmdev->map);
 }