Pārlūkot izejas kodu

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-

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>smpl>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shraddha Barke 10 gadi atpakaļ
vecāks
revīzija
f999d0987e
1 mainītis faili ar 1 papildinājumiem un 3 dzēšanām
  1. 1 3
      drivers/staging/lustre/lustre/osc/osc_request.c

+ 1 - 3
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);