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>
 
                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",