diff options
author | Bhanusree Pola | 2019-03-22 03:38:16 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2019-03-22 15:20:25 +0100 |
commit | 561fb35a9d04ca7d1a5b955bcac50c6c4f49227d (patch) | |
tree | c5de1abbc9bcc11a2bc119d9d33cc850d5415131 /drivers/staging/erofs/inode.c | |
parent | staging: rtl8188eu: remove unnecessary parentheses (diff) | |
download | kernel-qcow2-linux-561fb35a9d04ca7d1a5b955bcac50c6c4f49227d.tar.gz kernel-qcow2-linux-561fb35a9d04ca7d1a5b955bcac50c6c4f49227d.tar.xz kernel-qcow2-linux-561fb35a9d04ca7d1a5b955bcac50c6c4f49227d.zip |
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/inode.c')
-rw-r--r-- | drivers/staging/erofs/inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/erofs/inode.c b/drivers/staging/erofs/inode.c index 2df096afe91f..c7d3b815a798 100644 --- a/drivers/staging/erofs/inode.c +++ b/drivers/staging/erofs/inode.c @@ -129,7 +129,7 @@ static int fill_inline_data(struct inode *inode, void *data, if (S_ISLNK(inode->i_mode) && inode->i_size < PAGE_SIZE) { char *lnk = erofs_kmalloc(sbi, inode->i_size + 1, GFP_KERNEL); - if (unlikely(lnk == NULL)) + if (unlikely(!lnk)) return -ENOMEM; m_pofs += vi->inode_isize + vi->xattr_isize; @@ -265,7 +265,7 @@ struct inode *erofs_iget(struct super_block *sb, { struct inode *inode = erofs_iget_locked(sb, nid); - if (unlikely(inode == NULL)) + if (unlikely(!inode)) return ERR_PTR(-ENOMEM); if (inode->i_state & I_NEW) { |