mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maninder Singh <maninder1.s@samsung.com>
To: dledford@redhat.com, sean.hefty@intel.com, ogerlitz@mellanox.com,
	davem@davemloft.net, roland@purestorage.com, matanb@mellanox.com,
	monis@mellanox.com, jackm@dev.mellanox.co.il,
	yishaih@mellanox.com, eranbe@mellanox.com, ira.weiny@intel.com,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: pankaj.m@samsung.com, Maninder Singh <maninder1.s@samsung.com>
Subject: [PATCH 1/1] infiniband: Remove redundant NULL check before kfree
Date: Fri, 26 Jun 2015 12:39:07 +0530	[thread overview]
Message-ID: <1435302547-40904-1-git-send-email-maninder1.s@samsung.com> (raw)

kfree(NULL) is safe and this check is probably not required

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com>
---
 drivers/infiniband/hw/mlx4/main.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 067a691..4e60b39 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2676,10 +2676,8 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init)
 		dm[i] = kmalloc(sizeof (struct mlx4_ib_demux_work), GFP_ATOMIC);
 		if (!dm[i]) {
 			pr_err("failed to allocate memory for tunneling qp update work struct\n");
-			for (i = 0; i < dev->caps.num_ports; i++) {
-				if (dm[i])
-					kfree(dm[i]);
-			}
+			for (i = 0; i < dev->caps.num_ports; i++)
+				kfree(dm[i]);
 			goto out;
 		}
 	}
-- 
1.7.9.5


             reply	other threads:[~2015-06-26  7:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26  7:09 Maninder Singh [this message]
2015-07-07 18:53 ` Doug Ledford
2015-07-09 17:06 ` Christoph Lameter
2015-07-08  4:23 Maninder Singh
2015-07-08 22:24 ` Doug Ledford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435302547-40904-1-git-send-email-maninder1.s@samsung.com \
    --to=maninder1.s@samsung.com \
    --cc=davem@davemloft.net \
    --cc=dledford@redhat.com \
    --cc=eranbe@mellanox.com \
    --cc=ira.weiny@intel.com \
    --cc=jackm@dev.mellanox.co.il \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=monis@mellanox.com \
    --cc=ogerlitz@mellanox.com \
    --cc=pankaj.m@samsung.com \
    --cc=roland@purestorage.com \
    --cc=sean.hefty@intel.com \
    --cc=yishaih@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®