2014-12-17 22:40:11

by Rickard Strandqvist

[permalink] [raw]
Subject: [PATCH] staging: lustre: lustre: mdc: mdc_lib.c: Removed an unnecessary NULL check

Removed an unnecessary NULL check.
I have checked the only place this function is called from.

Signed-off-by: Rickard Strandqvist <[email protected]>
---
drivers/staging/lustre/lustre/mdc/mdc_lib.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index e8732cc..a798c2b 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -224,10 +224,9 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
rec->cr_fsuid = from_kuid(&init_user_ns, current_fsuid());
rec->cr_fsgid = from_kgid(&init_user_ns, current_fsgid());
rec->cr_cap = cfs_curproc_cap_pack();
- if (op_data != NULL) {
- rec->cr_fid1 = op_data->op_fid1;
- rec->cr_fid2 = op_data->op_fid2;
- }
+ rec->cr_fid1 = op_data->op_fid1;
+ rec->cr_fid2 = op_data->op_fid2;
+
rec->cr_mode = mode;
cr_flags = mds_pack_open_flags(flags, mode);
rec->cr_rdev = rdev;
--
1.7.10.4


2014-12-18 09:15:01

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: lustre: lustre: mdc: mdc_lib.c: Removed an unnecessary NULL check

On Wed, Dec 17, 2014 at 11:42:53PM +0100, Rickard Strandqvist wrote:
> Removed an unnecessary NULL check.
> I have checked the only place this function is called from.

Next time, in the changelog mention that the checking isn't consistent
so it creates as static checker warning. That is a good motivation for
writing these patches.

Anway, looks good.

Reviewed-by: Dan Carpenter <[email protected]>

regards,
dan carpenter