Skip to contentSkip to conversation

vmalloc: remove redundant NULL check

PATCH Applied Yang Li 2 participants 2 messages Jan 21, 2021

Subsystems (5)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 vmalloc: remove redundant NULL check

Fix below warnings reported by coccicheck:
./fs/proc/vmcore.c:1503:2-7: WARNING: NULL check before some freeing functions is not needed.

---
 fs/proc/vmcore.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
fs/proc/vmcore.c +2 -5
index c3a345c..9a15334 100644
@@ -1503,11 +1503,8 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
 	return 0;
 
 out_err:
-	if (buf)
-		vfree(buf);
-
-	if (dump)
-		vfree(dump);
+	vfree(buf);
+	vfree(dump);
 
 	return ret;
 }
Signature · 7 lines
1.8.3.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Yang Li

Fix below warnings reported by coccicheck:
./fs/proc/vmcore.c:1503:2-7: WARNING: NULL check before some freeing functions is not needed.

---
 fs/proc/vmcore.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
fs/proc/vmcore.c +0 -0
index c3a345c..9a15334 100644

fs/proc/vmcore.c int vmcore_add_device_dump(struct vmcoredd_data *data) · line 1507

Quoted 10 lines
fs/proc/vmcore.c +2 -5
@@ -1503,11 +1503,8 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
 	return 0;
 
 out_err:
-	if (buf)
-		vfree(buf);
-
-	if (dump)
-		vfree(dump);
+	vfree(buf);
+	vfree(dump);

Looks good, thx.

Thanks
Baoquan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec