summaryrefslogtreecommitdiffstats
path: root/drivers/staging/erofs/unzip_pagevec.h
diff options
context:
space:
mode:
authorBhanusree Pola <bhanusreemahesh@gmail.com>2019-03-22 10:38:16 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-22 15:20:25 +0100
commit561fb35a9d04ca7d1a5b955bcac50c6c4f49227d (patch)
treec5de1abbc9bcc11a2bc119d9d33cc850d5415131 /drivers/staging/erofs/unzip_pagevec.h
parent51385436f181d273392400bf8ba4edc2768e1996 (diff)
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>
Diffstat (limited to 'drivers/staging/erofs/unzip_pagevec.h')
-rw-r--r--drivers/staging/erofs/unzip_pagevec.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/erofs/unzip_pagevec.h b/drivers/staging/erofs/unzip_pagevec.h
index 23856ba2742d..f37d8fd14771 100644
--- a/drivers/staging/erofs/unzip_pagevec.h
+++ b/drivers/staging/erofs/unzip_pagevec.h
@@ -43,7 +43,7 @@ struct z_erofs_pagevec_ctor {
static inline void z_erofs_pagevec_ctor_exit(struct z_erofs_pagevec_ctor *ctor,
bool atomic)
{
- if (ctor->curr == NULL)
+ if (!ctor->curr)
return;
if (atomic)
@@ -59,7 +59,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor,
unsigned index;
/* keep away from occupied pages */
- if (ctor->next != NULL)
+ if (ctor->next)
return ctor->next;
for (index = 0; index < nr; ++index) {
@@ -121,7 +121,7 @@ z_erofs_pagevec_ctor_enqueue(struct z_erofs_pagevec_ctor *ctor,
bool *occupied)
{
*occupied = false;
- if (unlikely(ctor->next == NULL && type))
+ if (unlikely(!ctor->next && type))
if (ctor->index + 1 == ctor->nr)
return false;