From 57876fd8bf6b90362ae511c4d201847a1e18bacf Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Fri, 1 May 2015 21:38:02 +0200 Subject: [PATCH] Staging: lustre: llite: dir: remove unneeded null test before free Kfree can cope with a null argument, so drop null tests. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression ptr; @@ - if (ptr != NULL) kfree(ptr); // This patch additionally simplifies one case where the free, and thus the jump to the end of the function, is not needed. Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dir.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index f17154aaa329..4b0de8d89e5c 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -754,10 +754,8 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, char *buf; param = kzalloc(MGS_PARAM_MAXLEN, GFP_NOFS); - if (!param) { - rc = -ENOMEM; - goto end; - } + if (!param) + return -ENOMEM; buf = param; /* Get fsname and assume devname to be -MDT0000. */ @@ -786,8 +784,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param); end: - if (param != NULL) - kfree(param); + kfree(param); } return rc; } -- 2.20.1