Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1295474 > unrolled thread

[PATCH] nvmem: delete unneeded IS_ERR test

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2015-12-19 22:40 +0100
Last post2015-12-20 03:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] nvmem: delete unneeded IS_ERR test Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-19 22:40 +0100
    Re: [PATCH] nvmem: delete unneeded IS_ERR test Caesar Wang <caesar.upstream@gmail.com> - 2015-12-20 03:30 +0100

#1295474 — [PATCH] nvmem: delete unneeded IS_ERR test

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2015-12-19 22:40 +0100
Subject[PATCH] nvmem: delete unneeded IS_ERR test
Message-ID<qHxol-8wo-3@gated-at.bofh.it>
devm_kzalloc returns NULL rather than an ERR_PTR value.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,e;
@@

* x = devm_kzalloc(...)
... when != x = e
* IS_ERR(x)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/nvmem/rockchip-efuse.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
index f552134..811c73c 100644
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -136,8 +136,8 @@ static int rockchip_efuse_probe(struct platform_device *pdev)
 
 	context = devm_kzalloc(dev, sizeof(struct rockchip_efuse_context),
 			       GFP_KERNEL);
-	if (IS_ERR(context))
-		return PTR_ERR(context);
+	if (!context)
+		return -ENOMEM;
 
 	clk = devm_clk_get(dev, "pclk_efuse");
 	if (IS_ERR(clk))

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1295496

FromCaesar Wang <caesar.upstream@gmail.com>
Date2015-12-20 03:30 +0100
Message-ID<qHBUZ-2YB-5@gated-at.bofh.it>
In reply to#1295474
Hi Julia,

Thanks to check this, but there was a patch fixing it.:-)


在 2015年12月20日 05:19, Julia Lawall 写道:
> devm_kzalloc returns NULL rather than an ERR_PTR value.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression x,e;
> @@
>
> * x = devm_kzalloc(...)
> ... when != x = e
> * IS_ERR(x)
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>   drivers/nvmem/rockchip-efuse.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
> index f552134..811c73c 100644
> --- a/drivers/nvmem/rockchip-efuse.c
> +++ b/drivers/nvmem/rockchip-efuse.c
> @@ -136,8 +136,8 @@ static int rockchip_efuse_probe(struct platform_device *pdev)
>   
>   	context = devm_kzalloc(dev, sizeof(struct rockchip_efuse_context),
>   			       GFP_KERNEL);
> -	if (IS_ERR(context))
> -		return PTR_ERR(context);
> +	if (!context)
> +		return -ENOMEM;

Fixed in this patch[0].

patch[0]:
https://patchwork.kernel.org/patch/7842821/

Thanks,
Caesar
>   
>   	clk = devm_clk_get(dev, "pclk_efuse");
>   	if (IS_ERR(clk))
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web