Commit fb81e732 authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: remove unnecessary NULL checks in kernel_comm.c

Fix checkpatch.pl reports of NULL comparison in kernel_comm.c.
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 16b376bb
...@@ -59,7 +59,7 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload) ...@@ -59,7 +59,7 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
mm_segment_t fs; mm_segment_t fs;
int rc = -ENOSYS; int rc = -ENOSYS;
if (filp == NULL || IS_ERR(filp)) if (!filp || IS_ERR(filp))
return -EBADF; return -EBADF;
if (kuch->kuc_magic != KUC_MAGIC) { if (kuch->kuc_magic != KUC_MAGIC) {
...@@ -121,12 +121,12 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group, ...@@ -121,12 +121,12 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
} }
/* fput in group_rem */ /* fput in group_rem */
if (filp == NULL) if (!filp)
return -EBADF; return -EBADF;
/* freed in group_rem */ /* freed in group_rem */
reg = kmalloc(sizeof(*reg) + data_len, 0); reg = kmalloc(sizeof(*reg) + data_len, 0);
if (reg == NULL) if (!reg)
return -ENOMEM; return -ENOMEM;
reg->kr_fp = filp; reg->kr_fp = filp;
...@@ -134,7 +134,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group, ...@@ -134,7 +134,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
memcpy(reg->kr_data, data, data_len); memcpy(reg->kr_data, data, data_len);
down_write(&kg_sem); down_write(&kg_sem);
if (kkuc_groups[group].next == NULL) if (!kkuc_groups[group].next)
INIT_LIST_HEAD(&kkuc_groups[group]); INIT_LIST_HEAD(&kkuc_groups[group]);
list_add(&reg->kr_chain, &kkuc_groups[group]); list_add(&reg->kr_chain, &kkuc_groups[group]);
up_write(&kg_sem); up_write(&kg_sem);
...@@ -149,7 +149,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group) ...@@ -149,7 +149,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group)
{ {
struct kkuc_reg *reg, *next; struct kkuc_reg *reg, *next;
if (kkuc_groups[group].next == NULL) if (!kkuc_groups[group].next)
return 0; return 0;
if (uid == 0) { if (uid == 0) {
...@@ -169,7 +169,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group) ...@@ -169,7 +169,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group)
list_del(&reg->kr_chain); list_del(&reg->kr_chain);
CDEBUG(D_KUC, "Removed uid=%d fp=%p from group %d\n", CDEBUG(D_KUC, "Removed uid=%d fp=%p from group %d\n",
reg->kr_uid, reg->kr_fp, group); reg->kr_uid, reg->kr_fp, group);
if (reg->kr_fp != NULL) if (reg->kr_fp)
fput(reg->kr_fp); fput(reg->kr_fp);
kfree(reg); kfree(reg);
} }
...@@ -188,7 +188,7 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload) ...@@ -188,7 +188,7 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload)
down_write(&kg_sem); down_write(&kg_sem);
list_for_each_entry(reg, &kkuc_groups[group], kr_chain) { list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
if (reg->kr_fp != NULL) { if (reg->kr_fp) {
rc = libcfs_kkuc_msg_put(reg->kr_fp, payload); rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
if (rc == 0) if (rc == 0)
one_success = 1; one_success = 1;
...@@ -227,12 +227,12 @@ int libcfs_kkuc_group_foreach(unsigned int group, libcfs_kkuc_cb_t cb_func, ...@@ -227,12 +227,12 @@ int libcfs_kkuc_group_foreach(unsigned int group, libcfs_kkuc_cb_t cb_func,
} }
/* no link for this group */ /* no link for this group */
if (kkuc_groups[group].next == NULL) if (!kkuc_groups[group].next)
return 0; return 0;
down_read(&kg_sem); down_read(&kg_sem);
list_for_each_entry(reg, &kkuc_groups[group], kr_chain) { list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
if (reg->kr_fp != NULL) if (reg->kr_fp)
rc = cb_func(reg->kr_data, cb_arg); rc = cb_func(reg->kr_data, cb_arg);
} }
up_read(&kg_sem); up_read(&kg_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment