diff mbox

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

Message ID 563C7B7A.2080403@users.sourceforge.net (mailing list archive)
State Accepted
Headers show

Commit Message

SF Markus Elfring Nov. 6, 2015, 10:05 a.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 drivers/misc/cxl/context.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Andrew Donnellan Nov. 8, 2015, 10:56 p.m. UTC | #1
On 06/11/15 21:05, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>

Thanks for picking this up - will remember in my future patches.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Ian Munsie Nov. 9, 2015, 2:09 a.m. UTC | #2
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Michael Ellerman April 13, 2016, 1:33 p.m. UTC | #3
On Fri, 2015-06-11 at 10:05:46 UTC, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>
> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> Acked-by: Ian Munsie <imunsie@au1.ibm.com>

Applied to powerpc next, thanks.

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

cheers
diff mbox

Patch

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);
 }