Thread (1341 messages) 1341 messages, 165 authors, 2017-04-12

[PATCH] SGI-XPC: Delete an unnecessary check before the function call "kfree"

From: SF Markus Elfring <hidden>
Date: 2015-02-04 19:55:03
Also in: kernel-janitors
Subsystem: char and misc drivers, sgi xp/xpc/xpnet driver, the rest · Maintainers: Arnd Bergmann, Greg Kroah-Hartman, Robin Holt, Steve Wahl, Linus Torvalds

From: Markus Elfring <redacted>
Date: Wed, 4 Feb 2015 20:50:31 +0100

The kfree() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/misc/sgi-xp/xpc_partition.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 6956f7e..0e32431 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -98,8 +98,7 @@ xpc_get_rsvd_page_pa(int nasid)
 			len = L1_CACHE_ALIGN(len);
 
 		if (len > buf_len) {
-			if (buf_base != NULL)
-				kfree(buf_base);
+			kfree(buf_base);
 			buf_len = L1_CACHE_ALIGN(len);
 			buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
 							    &buf_base);
-- 
2.2.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help