coccinelle: put_device: reduce false positives
authorWen Yang <wen.yang99@zte.com.cn>
Sat, 23 Mar 2019 06:14:31 +0000 (14:14 +0800)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 28 Mar 2019 14:45:59 +0000 (23:45 +0900)
Don't complain about a return when this function returns "&pdev->dev".

Fixes: da9cfb87a44d ("coccinelle: semantic code search for missing put_device()")
Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/coccinelle/free/put_device.cocci

index 7395697e7f19a5f524d883b7079197434c2983ae..c9f071b0a0ab70b647bec3633571059934ece1bc 100644 (file)
@@ -32,6 +32,7 @@ if (id == NULL || ...) { ... return ...; }
 (    id
 |    (T2)dev_get_drvdata(&id->dev)
 |    (T3)platform_get_drvdata(id)
+|    &id->dev
 );
 | return@p2 ...;
 )