Commit 53db33a4 authored by Bhanusree Pola's avatar Bhanusree Pola Committed by Greg Kroah-Hartman

Staging: media: Use !x in place of NULL comparision

Test for NULL as !x instead of NULL comparisions for
functions that return NULL on failure.
Issue found using coccinelle
Semantic patch used to solve the problem is as follows

// <smpl>
@@
expression x;
statement S;
@@

x = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|
usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...));

-if(x==NULL)
+if(!x)
// </smpl>
Signed-off-by: default avatarBhanusree Pola <bhanusreemahesh@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 85b45ead
......@@ -332,7 +332,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh)
if (fh->buffers.need_contiguous) {
mem = kmalloc(fh->buffers.buffer_size, GFP_KERNEL);
if (mem == NULL) {
if (!mem) {
dprintk(1,
KERN_ERR
"%s: %s - kmalloc failed for buffer %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment