* [Outreachy kernel] [PATCH 1/5] staging: comedi: use !x in place of NULL comparison
2019-03-31 18:03 [Outreachy kernel] [PATCH 0/5] staging: Use !x in place of NULL comparison Payal Kshirsagar
@ 2019-03-31 18:03 ` Payal Kshirsagar
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 2/5] staging: rtlwifi: " Payal Kshirsagar
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 18:03 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Payal Kshirsagar
Challenge suggested by coccinelle.
Avoid NULL comparison, compare using boolean operator.
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
drivers/staging/comedi/drivers/tests/ni_routes_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
index c6dc18f..f809051 100644
--- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
+++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
@@ -282,7 +282,7 @@ void test_ni_sort_device_routes(void)
void test_ni_find_route_set(void)
{
- unittest(ni_find_route_set(bad_dest, &DR) == NULL,
+ unittest(!ni_find_route_set(bad_dest, &DR),
"check for nonexistent route_set\n");
unittest(ni_find_route_set(dest0, &DR) == &DR.routes[0],
"find first route_set\n");
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Outreachy kernel] [PATCH 2/5] staging: rtlwifi: use !x in place of NULL comparison
2019-03-31 18:03 [Outreachy kernel] [PATCH 0/5] staging: Use !x in place of NULL comparison Payal Kshirsagar
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 1/5] staging: comedi: use " Payal Kshirsagar
@ 2019-03-31 18:03 ` Payal Kshirsagar
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 3/5] staging: erofs: super.c: " Payal Kshirsagar
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 18:03 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Payal Kshirsagar
Challenge suggested by coccinelle.
Avoid NULL comparison, compare using boolean operator.
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
index dbb11c2..e661fc7 100644
--- a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -33,7 +33,7 @@ static const char *const gl_btc_wifi_freq_string[] = {
static bool halbtc_is_bt_coexist_available(struct btc_coexist *btcoexist)
{
- if (!btcoexist->binded || NULL == btcoexist->adapter)
+ if (!btcoexist->binded || !btcoexist->adapter)
return false;
return true;
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Outreachy kernel] [PATCH 3/5] staging: erofs: super.c: use !x in place of NULL comparison
2019-03-31 18:03 [Outreachy kernel] [PATCH 0/5] staging: Use !x in place of NULL comparison Payal Kshirsagar
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 1/5] staging: comedi: use " Payal Kshirsagar
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 2/5] staging: rtlwifi: " Payal Kshirsagar
@ 2019-03-31 18:03 ` Payal Kshirsagar
2019-04-01 17:22 ` Greg KH
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 4/5] staging: erofs: xattr.c: " Payal Kshirsagar
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 5/5] staging: erofs: inode.c: " Payal Kshirsagar
4 siblings, 1 reply; 7+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 18:03 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Payal Kshirsagar
Challenge suggested by coccinelle.
Avoid NULL comparison, compare using boolean operator.
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
drivers/staging/erofs/super.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 15c784f..a3aeb72 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -49,7 +49,7 @@ static struct inode *alloc_inode(struct super_block *sb)
struct erofs_vnode *vi =
kmem_cache_alloc(erofs_inode_cachep, GFP_KERNEL);
- if (vi == NULL)
+ if (!vi)
return NULL;
/* zero out everything except vfs_inode */
@@ -86,7 +86,7 @@ static int superblock_read(struct super_block *sb)
bh = sb_bread(sb, 0);
- if (bh == NULL) {
+ if (!bh) {
errln("cannot read erofs superblock");
return -EIO;
}
@@ -336,7 +336,7 @@ static struct inode *erofs_init_managed_cache(struct super_block *sb)
{
struct inode *inode = new_inode(sb);
- if (unlikely(inode == NULL))
+ if (unlikely(!inode))
return ERR_PTR(-ENOMEM);
set_nlink(inode, 1);
@@ -367,7 +367,7 @@ static int erofs_read_super(struct super_block *sb,
}
sbi = kzalloc(sizeof(struct erofs_sb_info), GFP_KERNEL);
- if (unlikely(sbi == NULL)) {
+ if (unlikely(!sbi)) {
err = -ENOMEM;
goto err;
}
@@ -431,14 +431,14 @@ static int erofs_read_super(struct super_block *sb,
}
sb->s_root = d_make_root(inode);
- if (sb->s_root == NULL) {
+ if (!sb->s_root) {
err = -ENOMEM;
goto err_iget;
}
/* save the device name to sbi */
sbi->dev_name = __getname();
- if (sbi->dev_name == NULL) {
+ if (!sbi->dev_name) {
err = -ENOMEM;
goto err_devname;
}
@@ -481,7 +481,7 @@ static void erofs_put_super(struct super_block *sb)
struct erofs_sb_info *sbi = EROFS_SB(sb);
/* for cases which are failed in "read_super" */
- if (sbi == NULL)
+ if (!sbi)
return;
WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [Outreachy kernel] [PATCH 3/5] staging: erofs: super.c: use !x in place of NULL comparison
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 3/5] staging: erofs: super.c: " Payal Kshirsagar
@ 2019-04-01 17:22 ` Greg KH
0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2019-04-01 17:22 UTC (permalink / raw)
To: Payal Kshirsagar; +Cc: outreachy-kernel
On Sun, Mar 31, 2019 at 11:33:49PM +0530, Payal Kshirsagar wrote:
> Challenge suggested by coccinelle.
> Avoid NULL comparison, compare using boolean operator.
>
> Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
> ---
> drivers/staging/erofs/super.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
These 3 erofs patches are already changed in my tree and do not apply at
all. Be sure you are always working against the correct tree and
branch.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Outreachy kernel] [PATCH 4/5] staging: erofs: xattr.c: use !x in place of NULL comparison
2019-03-31 18:03 [Outreachy kernel] [PATCH 0/5] staging: Use !x in place of NULL comparison Payal Kshirsagar
` (2 preceding siblings ...)
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 3/5] staging: erofs: super.c: " Payal Kshirsagar
@ 2019-03-31 18:03 ` Payal Kshirsagar
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 5/5] staging: erofs: inode.c: " Payal Kshirsagar
4 siblings, 0 replies; 7+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 18:03 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Payal Kshirsagar
Challenge suggested by coccinelle.
Avoid NULL comparison, compare using boolean operator.
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
drivers/staging/erofs/xattr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/erofs/xattr.c b/drivers/staging/erofs/xattr.c
index f716ab0..aecbbda 100644
--- a/drivers/staging/erofs/xattr.c
+++ b/drivers/staging/erofs/xattr.c
@@ -36,7 +36,7 @@ static inline void xattr_iter_end(struct xattr_iter *it, bool atomic)
static inline void xattr_iter_end_final(struct xattr_iter *it)
{
- if (it->page == NULL)
+ if (!it->page)
return;
xattr_iter_end(it, true);
@@ -107,7 +107,7 @@ static int init_inode_xattrs(struct inode *inode)
vi->xattr_shared_count = ih->h_shared_count;
vi->xattr_shared_xattrs = kmalloc_array(vi->xattr_shared_count,
sizeof(uint), GFP_KERNEL);
- if (vi->xattr_shared_xattrs == NULL) {
+ if (!vi->xattr_shared_xattrs) {
xattr_iter_end(&it, atomic_map);
ret = -ENOMEM;
goto out_unlock;
@@ -344,7 +344,7 @@ static int xattr_checkbuffer(struct xattr_iter *_it,
int err = it->buffer_size < value_sz ? -ERANGE : 0;
it->buffer_size = value_sz;
- return it->buffer == NULL ? 1 : err;
+ return !it->buffer ? 1 : err;
}
static void xattr_copyvalue(struct xattr_iter *_it,
@@ -435,7 +435,7 @@ int erofs_getxattr(struct inode *inode, int index,
int ret;
struct getxattr_iter it;
- if (unlikely(name == NULL))
+ if (unlikely(!name))
return -EINVAL;
ret = init_inode_xattrs(inode);
@@ -543,7 +543,7 @@ static int xattr_entrylist(struct xattr_iter *_it,
prefix = xattr_prefix(h);
prefix_len = strlen(prefix);
- if (it->buffer == NULL) {
+ if (!it->buffer) {
it->buffer_ofs += prefix_len + entry->e_name_len + 1;
return 1;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Outreachy kernel] [PATCH 5/5] staging: erofs: inode.c: use !x in place of NULL comparison
2019-03-31 18:03 [Outreachy kernel] [PATCH 0/5] staging: Use !x in place of NULL comparison Payal Kshirsagar
` (3 preceding siblings ...)
2019-03-31 18:03 ` [Outreachy kernel] [PATCH 4/5] staging: erofs: xattr.c: " Payal Kshirsagar
@ 2019-03-31 18:03 ` Payal Kshirsagar
4 siblings, 0 replies; 7+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 18:03 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Payal Kshirsagar
Challenge suggested by coccinelle.
Avoid NULL comparison, compare using boolean operator.
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
drivers/staging/erofs/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/erofs/inode.c b/drivers/staging/erofs/inode.c
index 924b8df..90d6aa3 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;
@@ -264,7 +264,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) {
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread