public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/cxgb4: Delete an unnecessary check before kfree() in c4iw_rdev_open()
@ 2025-06-10 12:20 Markus Elfring
  2025-06-12  8:38 ` Leon Romanovsky
  2025-06-12  8:39 ` Leon Romanovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Elfring @ 2025-06-10 12:20 UTC (permalink / raw)
  To: linux-rdma, Jason Gunthorpe, Leon Romanovsky, Potnuri Bharat Teja
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 10 Jun 2025 14:14:09 +0200

It can be known that the function “kfree” performs a null pointer check
for its input parameter.
It is therefore not needed to repeat such a check before its call.

Thus remove a redundant pointer check.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/hw/cxgb4/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index 034b85c42255..c0eb166a49b9 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -905,7 +905,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 
 	return 0;
 err_free_status_page_and_wr_log:
-	if (c4iw_wr_log && rdev->wr_log)
+	if (c4iw_wr_log)
 		kfree(rdev->wr_log);
 	free_page((unsigned long)rdev->status_page);
 destroy_ocqp_pool:
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-12  8:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 12:20 [PATCH] RDMA/cxgb4: Delete an unnecessary check before kfree() in c4iw_rdev_open() Markus Elfring
2025-06-12  8:38 ` Leon Romanovsky
2025-06-12  8:39 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox