staging: erofs: Use !x or x in place of NULL comparision
authorBhanusree Pola <bhanusreemahesh@gmail.com>
Fri, 22 Mar 2019 02:38:16 +0000 (10:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 Mar 2019 14:20:25 +0000 (15:20 +0100)
commit561fb35a9d04ca7d1a5b955bcac50c6c4f49227d
treec5de1abbc9bcc11a2bc119d9d33cc850d5415131
parent51385436f181d273392400bf8ba4edc2768e1996
staging: erofs: Use !x or x in place of NULL comparision

Test for NULL as !x instead of NULL comparisions.
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)
S

@@
expression e;
@@

-e == NULL
+!e
// </smpl>

Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
[ Gao Xiang: fix x != NULL comparision to x as well. ]
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/erofs/inode.c
drivers/staging/erofs/internal.h
drivers/staging/erofs/super.c
drivers/staging/erofs/unzip_pagevec.h
drivers/staging/erofs/utils.c
drivers/staging/erofs/xattr.c