From patchwork Fri Jun 26 07:09:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maninder Singh X-Patchwork-Id: 6678531 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8689EC05AC for ; Fri, 26 Jun 2015 07:11:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF3E42070C for ; Fri, 26 Jun 2015 07:11:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C2EC20703 for ; Fri, 26 Jun 2015 07:11:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751689AbbFZHLG (ORCPT ); Fri, 26 Jun 2015 03:11:06 -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 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NQJ002KBIMFAZ80@mailout3.samsung.com>; Fri, 26 Jun 2015 16:11:03 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id CE.B6.24422.70BFC855; Fri, 26 Jun 2015 16:11:03 +0900 (KST) X-AuditID: cbfee68f-f793b6d000005f66-80-558cfb073cf4 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 22.96.05312.70BFC855; Fri, 26 Jun 2015 16:11:03 +0900 (KST) Received: from localhost.localdomain ([107.108.92.210]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NQJ003UQILFJWH0@mmp1.samsung.com>; Fri, 26 Jun 2015 16:11:02 +0900 (KST) 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+Db5EAtEjazEpgPMEMdJShxccYNlAqPgAkaGVYyiqQXJBcVJ6UXG esWJucWleel6yfm5mxiBEXL637P+HYx3D1gfYhTgYFTi4Q240xMqxJpYVlyZe4jRFGjD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xbN9xeLGd0dJta+kaDf5sMNqe6eZhP nvK6fHWLqN1MV61fm7o+mL65GxS2veqJXFvOMaOlNTtEorf2r/li8OeprX65COvmwrbQSdtD 74seLvy26anL6jBV60lnvA4qsRRnJBpqMRcVJwIAABodVtUCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kfree(NULL) is safe and this check is probably not required Signed-off-by: Maninder Singh Reviewed-by: Akhilesh Kumar Acked-by: Christoph Lameter --- 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; } }