From: Markus Elfring Date: Wed, 8 May 2019 11:50:49 +0000 (+0200) Subject: coccinelle: put_device: Add a cast to an expression for an assignment X-Git-Tag: v5.4-rc1~587^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f58c17c202e7aec9623754a7ec0b0669e043b838;p=platform%2Fkernel%2Flinux-rpi.git coccinelle: put_device: Add a cast to an expression for an assignment 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 Suggested-by: Julia Lawall Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/ Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html Acked-by: Julia Lawall Signed-off-by: Masahiro Yamada --- diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci index 3ebebc0..1209213 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) (