diff options
author | Bhanusree Pola <bhanusreemahesh@gmail.com> | 2019-03-21 15:05:27 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-21 20:08:07 +0100 |
commit | 53db33a489349128a2a430f8f0e924417c4c31c8 (patch) | |
tree | 89e50eb50f0bfe4c0feef80fbce4f390ed807eb4 /drivers/staging/media | |
parent | staging: netlogic: Remove unnecessary error print (diff) | |
download | linux-dev-53db33a489349128a2a430f8f0e924417c4c31c8.tar.xz linux-dev-53db33a489349128a2a430f8f0e924417c4c31c8.zip |
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: Bhanusree Pola <bhanusreemahesh@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/media')
-rw-r--r-- | drivers/staging/media/zoran/zoran_driver.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 04f88f9d6bb4..0a99e16e5bd5 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -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", |