Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1263884 > unrolled thread

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

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2015-11-06 11:10 +0100
Last post2015-11-09 03:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] cxl: Delete an unnecessary check before the function call  "kfree" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-06 11:10 +0100
    Re: [PATCH] cxl: Delete an unnecessary check before the function  call "kfree" Andrew Donnellan <andrew.donnellan@au1.ibm.com> - 2015-11-09 00:00 +0100
    Re: [PATCH] cxl: Delete an unnecessary check before the function call "kfree" Ian Munsie <imunsie@au1.ibm.com> - 2015-11-09 03:20 +0100

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

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-11-06 11:10 +0100
Subject[PATCH] cxl: Delete an unnecessary check before the function call "kfree"
Message-ID<qrM81-36S-21@gated-at.bofh.it>
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(-)

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


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

FromAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Date2015-11-09 00:00 +0100
SubjectRe: [PATCH] cxl: Delete an unnecessary check before the function call "kfree"
Message-ID<qsH6i-6m1-27@gated-at.bofh.it>
In reply to#1263884
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>

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


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

FromIan Munsie <imunsie@au1.ibm.com>
Date2015-11-09 03:20 +0100
SubjectRe: [PATCH] cxl: Delete an unnecessary check before the function call "kfree"
Message-ID<qsKdQ-8vV-9@gated-at.bofh.it>
In reply to#1263884
Acked-by: Ian Munsie <imunsie@au1.ibm.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web