All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: lustre: llite: Remove IS_ERR tests
@ 2016-02-16 12:08 Amitoj Kaur Chawla
  2016-02-20 22:38 ` [Outreachy kernel] " Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-16 12:08 UTC (permalink / raw)
  To: outreachy-kernel

ll_iget() has been modified to always return NULL in case of error and
not a ERR_PTR.

Consequently, remove unnecessary IS_ERR tests as now ll_iget() function 
can never return a ERR_PTR.

This patch also removes checkpatch warnings:
Comparison to NULL could be written "!root"
Comparison to NULL could be written "!inode"

Additionally, reinitialising root and inode to NULL has been removed
since they have already been tested for the same.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
Changes in v3:
        -Modified ll_iget() to only return NULL in case of error
Changes in v2:
        -Remove IS_ERR test instead of replacing it with
         IS_ERR_OR_NULL

 drivers/staging/lustre/lustre/llite/llite_lib.c | 10 ++++------
 drivers/staging/lustre/lustre/llite/namei.c     |  2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 446e4b8..a64b3f6 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -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 (!root) {
 		if (lmd.lsm)
 			obd_free_memmd(sbi->ll_dt_exp, &lmd.lsm);
 #ifdef CONFIG_FS_POSIX_ACL
@@ -502,8 +502,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 			lmd.posix_acl = NULL;
 		}
 #endif
-		err = IS_ERR(root) ? PTR_ERR(root) : -EBADF;
-		root = NULL;
+		err = -EBADF;
 		CERROR("lustre_lite: bad iget4 for root\n");
 		goto out_root;
 	}
@@ -1965,15 +1964,14 @@ 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 (!inode) {
 #ifdef CONFIG_FS_POSIX_ACL
 			if (md.posix_acl) {
 				posix_acl_release(md.posix_acl);
 				md.posix_acl = NULL;
 			}
 #endif
-			rc = IS_ERR(*inode) ? PTR_ERR(*inode) : -ENOMEM;
-			*inode = NULL;
+			rc = -ENOMEM;
 			CERROR("new_inode -fatal: rc %d\n", rc);
 			goto out;
 		}
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index da5f443..ca175cc 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -127,7 +127,7 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
 			}
 			if (rc != 0) {
 				iget_failed(inode);
-				inode = ERR_PTR(rc);
+				inode = NULL;
 			} else
 				unlock_new_inode(inode);
 		} else if (!(inode->i_state & (I_FREEING | I_CLEAR)))
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy kernel] [PATCH v3] staging: lustre: llite: Remove IS_ERR tests
  2016-02-16 12:08 [PATCH v3] staging: lustre: llite: Remove IS_ERR tests Amitoj Kaur Chawla
@ 2016-02-20 22:38 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2016-02-20 22:38 UTC (permalink / raw)
  To: Amitoj Kaur Chawla; +Cc: outreachy-kernel

On Tue, Feb 16, 2016 at 05:38:44PM +0530, Amitoj Kaur Chawla wrote:
> ll_iget() has been modified to always return NULL in case of error and
> not a ERR_PTR.
> 
> Consequently, remove unnecessary IS_ERR tests as now ll_iget() function 
> can never return a ERR_PTR.
> 
> This patch also removes checkpatch warnings:
> Comparison to NULL could be written "!root"
> Comparison to NULL could be written "!inode"
> 
> Additionally, reinitialising root and inode to NULL has been removed
> since they have already been tested for the same.
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
> Changes in v3:
>         -Modified ll_iget() to only return NULL in case of error
> Changes in v2:
>         -Remove IS_ERR test instead of replacing it with
>          IS_ERR_OR_NULL

This doesn't apply to my staging-testing branch due to other changes in
these files by other developers that were send before your patch.  Can
you please refresh your tree and rebase your patch and resend?

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-20 22:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 12:08 [PATCH v3] staging: lustre: llite: Remove IS_ERR tests Amitoj Kaur Chawla
2016-02-20 22:38 ` [Outreachy kernel] " Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.