Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751751AbbFZHLM (ORCPT ); Fri, 26 Jun 2015 03:11:12 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:37475 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbbFZHLF (ORCPT ); Fri, 26 Jun 2015 03:11:05 -0400 X-AuditID: cbfee68f-f793b6d000005f66-80-558cfb073cf4 From: Maninder Singh 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 Subject: [PATCH 1/1] infiniband: Remove redundant NULL check before kfree Date: Fri, 26 Jun 2015 12:39:07 +0530 Message-id: <1435302547-40904-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRmVeSWpSXmKPExsWyRsSkWpf9d0+owck/ohZzzrewWLw8/4HV YuHbP2wW+58+Z7FYsLSL0eLyrjlsFs8O9bJYHJ7fxmLx5qWTxYb3a9gtpt86zmhx781WJovV fywsmtdvYLGYcKmHzYHfY8vKm0we02dsYvVYvOclk8ez6YeZPLY97GX3eL/vKptH35ZVjB6f N8kFcERx2aSk5mSWpRbp2yVwZRzb9Y+lYCt7xepJa1kaGJvYuhg5OSQETCT6PrSzQNhiEhfu rQeKc3EICSxllLjx9B87TNG6U9OZIBKLGCW+b3zHCuH8ZJRYfbWfGaSKTUBPYtWuPSwgCRGB bUwSRw4uBUpwcDALOElM/6oHUiMs4Cmxb+YfsNUsAqoSpy5cArN5BdwlTtz4AFYuIaAgMWeS DcgYCYFz7BIvdm6DqheQ+Db5EAtEjazEpgPMEMdJShxccYNlA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xHlP5vuECgmkJ5akZqemFqQWwfQxcXBKNTDmffpVKmQZ5cOl K/TlfZbBXvfe7y91VKcWnyh9fv2PzEluHfs10kt0OwxbN9xeLGd0dJta+kaDf5sMNqe6eZhP nvK6fHWLqN1MV61fm7o+mL65GxS2veqJXFvOMaOlNTtEorf2r/li8OeprX65COvmwrbQSdtD 74seLvy26anL6jBV60lnvA4qsRRnJBpqMRcVJwIAABodVtUCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1166 Lines: 33 kfree(NULL) is safe and this check is probably not required Signed-off-by: Maninder Singh Reviewed-by: Akhilesh Kumar --- 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 -- 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/