Re: [PATCH] coccinelle: put_device: reduce false positives

From: Julia Lawall
Date: Sat Mar 23 2019 - 09:41:13 EST




On Sat, 23 Mar 2019, Wen Yang wrote:

> Don't complain about a return when this function returns "&pdev->dev".
>
> Reported-by: Julia Lawall <Julia.Lawall@xxxxxxx>
> Signed-off-by: Wen Yang <wen.yang99@xxxxxxxxxx>
> Cc: Julia Lawall <Julia.Lawall@xxxxxxx>
> Cc: Gilles Muller <Gilles.Muller@xxxxxxx>
> Cc: Nicolas Palix <nicolas.palix@xxxxxxx>
> Cc: Michal Marek <michal.lkml@xxxxxxxxxxx>
> Cc: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
> CC: cocci@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx

Acked-by: Julia Lawall <julia.lawall@xxxxxxx>


> ---
> scripts/coccinelle/free/put_device.cocci | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 7395697..c9f071b 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -32,6 +32,7 @@ if (id == NULL || ...) { ... return ...; }
> ( id
> | (T2)dev_get_drvdata(&id->dev)
> | (T3)platform_get_drvdata(id)
> +| &id->dev
> );
> | return@p2 ...;
> )
> --
> 2.9.5
>
>