Skip to contentSkip to conversation

staging: lusture: llite: Use IS_ERR_OR_NULL

PATCH In review Bhaktipriya Shridhar 2 participants 2 messages Feb 17, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lusture: llite: Use IS_ERR_OR_NULL

Replaced tests for NULL and IS_ER with macro IS_ERR_OR_NULL.

The following Coccinelle semantic patch was used:

@@
expression ex;
@@

- ex == NULL || IS_ERR(ex)
+ IS_ERR_OR_NULL(ex)

---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -2
index 446e4b8..5a32f9f 100644
@@ -493,7 +493,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 	md_free_lustre_md(sbi->ll_md_exp, &lmd);
 	ptlrpc_req_finished(request);
 
-	if (root == NULL || IS_ERR(root)) {
+	if (IS_ERR_OR_NULL(root)) {
 		if (lmd.lsm)
 			obd_free_memmd(sbi->ll_dt_exp, &lmd.lsm);
 #ifdef CONFIG_FS_POSIX_ACL
@@ -1965,7 +1965,7 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
 		*inode = ll_iget(sb, cl_fid_build_ino(&md.body->fid1,
 					     sbi->ll_flags & LL_SBI_32BIT_API),
 				 &md);
-		if (*inode == NULL || IS_ERR(*inode)) {
+		if (IS_ERR_OR_NULL(*inode)) {
 #ifdef CONFIG_FS_POSIX_ACL
 			if (md.posix_acl) {
 				posix_acl_release(md.posix_acl);

--
2.1.4

#1 lore raw
Quoted 30 lines · Bhaktipriya Shridhar

Replaced tests for NULL and IS_ER with macro IS_ERR_OR_NULL.

The following Coccinelle semantic patch was used:

@@
expression ex;
@@

- ex == NULL || IS_ERR(ex)
+ IS_ERR_OR_NULL(ex)

---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
index 446e4b8..5a32f9f 100644
@@ -493,7 +493,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
        md_free_lustre_md(sbi->ll_md_exp, &lmd);
        ptlrpc_req_finished(request);
 
-       if (root == NULL || IS_ERR(root)) {
+       if (IS_ERR_OR_NULL(root)) {
                if (lmd.lsm)
                        obd_free_memmd(sbi->ll_dt_exp, &lmd.lsm);
 #ifdef CONFIG_FS_POSIX_ACL

drivers/staging/lustre/lustre/llite/llite_lib.c int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, · line 1968

Quoted 5 lines
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -1965,7 +1965,7 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
                *inode = ll_iget(sb, cl_fid_build_ino(&md.body->fid1,
                                             sbi->ll_flags & LL_SBI_32BIT_API),
                                 &md);
-               if (*inode == NULL || IS_ERR(*inode)) {
+               if (IS_ERR_OR_NULL(*inode)) {

Hi Bhaktipriya,

I've already sent a patch for this issue, you can see it here:
https://groups.google.com/forum/#!topic/outreachy-kernel/VsK7W2qZqCY

Thanks,
Amitoj