From f999d0987ec1e88c455fb95e48a12a98a9fbd9a6 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Mon, 12 Oct 2015 20:49:18 +0530 Subject: [PATCH] Staging: lustre: osc: Remove null check before kfree kfree on NULL pointer is a no-op. The semantic patch used to find such an instance where NULL check is present before kfree- // @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // smpl> Signed-off-by: Shraddha Barke Reviewed-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_request.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 225e5ed..86c0303e 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1998,9 +1998,7 @@ out: if (mem_tight != 0) cfs_memory_pressure_restore(mpflag); - if (crattr != NULL) { - kfree(crattr); - } + kfree(crattr); if (rc != 0) { LASSERT(req == NULL); -- 2.7.4