From: Yann Droneaud Date: Mon, 23 May 2016 15:07:20 +0000 (+0200) Subject: coccinelle: recognize more devm_* memory allocation functions X-Git-Tag: v4.14-rc1~2734^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a720c0644d14011d3a1bcc8d1b36e80571ad2ce1;p=platform%2Fkernel%2Flinux-rpi.git coccinelle: recognize more devm_* memory allocation functions Updates free/devm_free.cocci to recognize functions added by: - commit 64c862a839a8 ('devres: add kernel standard devm_k.alloc functions') - commit e31108cad3de ('devres: introduce API "devm_kstrdup"') - commit 3046365bb470 ('devres: introduce API "devm_kmemdup') - commit 43339bed7010 ('devres: Add devm_get_free_pages API') - commit 75f2a4ead5d5 ('devres: Add devm_kasprintf and devm_kvasprintf API') See also Documentation/driver-model/devres.txt Cc: Joe Perches Cc: Manish Badarkhe Cc: Srinivas Pandruvada Cc: Eli Billauer Cc: Himangi Saraogi Cc: Geert Uytterhoeven Cc: Wolfram Sang Cc: Daniel Thompson Acked-by: Julia Lawall Signed-off-by: Yann Droneaud Signed-off-by: Michal Marek --- diff --git a/scripts/coccinelle/free/devm_free.cocci b/scripts/coccinelle/free/devm_free.cocci index 83c03ad..3794cd9 100644 --- a/scripts/coccinelle/free/devm_free.cocci +++ b/scripts/coccinelle/free/devm_free.cocci @@ -29,8 +29,24 @@ expression x; @@ ( + x = devm_kmalloc(...) +| + x = devm_kvasprintf(...) +| + x = devm_kasprintf(...) +| x = devm_kzalloc(...) | + x = devm_kmalloc_array(...) +| + x = devm_kcalloc(...) +| + x = devm_kstrdup(...) +| + x = devm_kmemdup(...) +| + x = devm_get_free_pages(...) +| x = devm_request_irq(...) | x = devm_ioremap(...) @@ -50,6 +66,10 @@ position p; | * kzfree@p(x) | +* free_pages@p(x, ...) +| +* free_page@p(x) +| * free_irq@p(x) | * iounmap@p(x)