From 591ad6f1af1b418b1aebf69ae4e2e86b8eb2b0ad Mon Sep 17 00:00:00 2001 From: Sanjana Sanikommu Date: Sun, 31 Mar 2019 21:34:02 +0530 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/hid.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging/greybus') diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c index 0b72e1b9d325..8ab810bf5716 100644 --- a/drivers/staging/greybus/hid.c +++ b/drivers/staging/greybus/hid.c @@ -292,7 +292,6 @@ static int gb_hid_parse(struct hid_device *hid) rdesc = kzalloc(rsize, GFP_KERNEL); if (!rdesc) { - dbg_hid("couldn't allocate rdesc memory\n"); return -ENOMEM; } -- cgit v1.2.3