[PATCH] cxl: Delete an unnecessary check before the function call "kfree"

Subsystems: char and misc drivers, the rest

STALE3409d

4 messages, 4 authors, 2016-04-13 · open the first message on its own page

[PATCH] cxl: Delete an unnecessary check before the function call "kfree"

From: SF Markus Elfring <hidden>
Date: 2015-11-06 10:06:08

From: Markus Elfring <redacted>
Date: Fri, 6 Nov 2015 11:00:23 +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/cxl/context.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index 2faa127..52e39b6 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/misc/cxl/context.c
@@ -275,9 +275,7 @@ static void reclaim_ctx(struct rcu_head *rcu)
 	if (ctx->kernelapi)
 		kfree(ctx->mapping);
 
-	if (ctx->irq_bitmap)
-		kfree(ctx->irq_bitmap);
-
+	kfree(ctx->irq_bitmap);
 	kfree(ctx);
 }
 
-- 
2.6.2

Re: [PATCH] cxl: Delete an unnecessary check before the function call "kfree"

From: Andrew Donnellan <hidden>
Date: 2015-11-08 22:57:32

On 06/11/15 21:05, SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Fri, 6 Nov 2015 11:00:23 +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>
Thanks for picking this up - will remember in my future patches.

Reviewed-by: Andrew Donnellan <redacted>

-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited

Re: [PATCH] cxl: Delete an unnecessary check before the function call "kfree"

From: Ian Munsie <hidden>
Date: 2015-11-09 02:11:00

Acked-by: Ian Munsie <redacted>

Re: cxl: Delete an unnecessary check before the function call "kfree"

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-04-13 13:33:38

On Fri, 2015-06-11 at 10:05:46 UTC, SF Markus Elfring wrote:
From: Markus Elfring <redacted>
Date: Fri, 6 Nov 2015 11:00:23 +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>
Reviewed-by: Andrew Donnellan <redacted>
Acked-by: Ian Munsie <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/1050e689a63baffdadcd33498c

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help