]> asedeno.scripts.mit.edu Git - linux.git/commit
staging: greybus: hid: Remove print following unsuccessful kmalloc
authorSanjana Sanikommu <sanjana99reddy99@gmail.com>
Sun, 31 Mar 2019 16:04:02 +0000 (21:34 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Apr 2019 17:19:48 +0000 (19:19 +0200)
commit591ad6f1af1b418b1aebf69ae4e2e86b8eb2b0ad
tree31d4e2565bf490d39e575da94ff33730326b76b2
parentb397f82585c3101dcf92642dd359891e66d00c55
staging: greybus: hid: Remove print following unsuccessful kmalloc

Challenge suggested by Coccinelle
Remove print statement following unsuccessful kmalloc when there
is not enough memory. Kmalloc and variants normally produce a
backtrace in such a case. Hence, a print statement is not necessary.

Found using the following Coccinelle semantic patch:
@@
identifier i,print;
constant char [] c;
@@

i = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|
devm_ioremap\|usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\|
kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...));
(
if (i == NULL)
{
-print(...,c,...);
...when any
}
|
if (!i)
{
-print(...,c,...);
...when any
}
)

Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/hid.c