2019-05-13 09:17:01

by Markus Elfring

[permalink] [raw]
Subject: [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment

From: Markus Elfring <[email protected]>
Date: Wed, 8 May 2019 13:50:49 +0200

Extend a when constraint in a SmPL rule so that an additional cast
is optionally excluded from source code searches for an expression
in assignments.

Signed-off-by: Markus Elfring <[email protected]>
Suggested-by: Julia Lawall <[email protected]>
Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
---
scripts/coccinelle/free/put_device.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index 3ebebc064f10..120921366e84 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
when != e1 = (T)id
- when != e1 = &id->dev
+ when != e1 = (T)(&id->dev)
when != e1 = get_device(&id->dev)
when != e1 = (T1)platform_get_drvdata(id)
(
--
2.21.0


2019-05-13 10:22:22

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment



On Mon, 13 May 2019, Markus Elfring wrote:

> From: Markus Elfring <[email protected]>
> Date: Wed, 8 May 2019 13:50:49 +0200
>
> Extend a when constraint in a SmPL rule so that an additional cast
> is optionally excluded from source code searches for an expression
> in assignments.

Acked-by: Julia Lawall <[email protected]>

>
> Signed-off-by: Markus Elfring <[email protected]>
> Suggested-by: Julia Lawall <[email protected]>
> Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
> ---
> scripts/coccinelle/free/put_device.cocci | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 3ebebc064f10..120921366e84 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = (T)id
> - when != e1 = &id->dev
> + when != e1 = (T)(&id->dev)
> when != e1 = get_device(&id->dev)
> when != e1 = (T1)platform_get_drvdata(id)
> (
> --
> 2.21.0
>
>

2019-07-06 13:15:31

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [Cocci] [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment

On Mon, May 13, 2019 at 6:02 PM Markus Elfring <[email protected]> wrote:
>
> From: Markus Elfring <[email protected]>
> Date: Wed, 8 May 2019 13:50:49 +0200
>
> Extend a when constraint in a SmPL rule so that an additional cast
> is optionally excluded from source code searches for an expression
> in assignments.
>
> Signed-off-by: Markus Elfring <[email protected]>
> Suggested-by: Julia Lawall <[email protected]>
> Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
> ---

Applied to linux-kbuild.

> scripts/coccinelle/free/put_device.cocci | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 3ebebc064f10..120921366e84 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = (T)id
> - when != e1 = &id->dev
> + when != e1 = (T)(&id->dev)
> when != e1 = get_device(&id->dev)
> when != e1 = (T1)platform_get_drvdata(id)
> (
> --
> 2.21.0
>
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci



--
Best Regards
Masahiro Yamada