From patchwork Fri Apr 21 18:36:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9693443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 671456038D for ; Fri, 21 Apr 2017 18:37:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 356CF28654 for ; Fri, 21 Apr 2017 18:37:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28A5C28660; Fri, 21 Apr 2017 18:37:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 891FF28654 for ; Fri, 21 Apr 2017 18:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1041364AbdDUSgu (ORCPT ); Fri, 21 Apr 2017 14:36:50 -0400 Received: from mout.web.de ([212.227.15.4]:53405 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1040204AbdDUSgr (ORCPT ); Fri, 21 Apr 2017 14:36:47 -0400 Received: from [192.168.1.2] ([77.182.39.184]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lxf5f-1bvGDJ1vCt-017D8o; Fri, 21 Apr 2017 20:36:10 +0200 Subject: [PATCH v2 06/17] IB/mlx4: Delete an unnecessary check before kfree() in free_pv_object() From: SF Markus Elfring To: Doug Ledford , Hal Rosenstock , Leon Romanovsky , Majd Dibbiny , Matan Barak , Sean Hefty , Yishai Hadas , linux-rdma@vger.kernel.org Cc: LKML , kernel-janitors@vger.kernel.org References: <1935365a-bd7c-461e-6a84-0c5d3a501fff@users.sourceforge.net> <1492720654.3041.16.camel@redhat.com> Message-ID: <950a4a7f-01f6-9791-5d4c-41abe07366ed@users.sourceforge.net> Date: Fri, 21 Apr 2017 20:36:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:FVCRkXYjCTHokk1puw7S3ZVklfrC1sIq9TaqsxfakvvBSiShd/b 2d3V0/5jV0EdvooA+SKmStPdlUdjlV4XcKOvgmWBbbgvwuXLPHfMadh72tocJYkcv5xC1dd kSVtHvxHTEAMwHJt7i9aVazFrZygIErV1tEPoKA0rBU34UURoQFD6uzlCV4XknePNf3CCpb i4I3Mf9ee8CgBC/O0fbwA== X-UI-Out-Filterresults: notjunk:1; V01:K0:CMkSY0w4DwA=:Px7gjm9UfgES59J+/HrqqU AymTd0DLefOnmH/Ue3AjNcsWbMKvYUfxxvkqMsKGyeD8soIpOgusn4Nin2oBv98dbfBU+VqZj OWXUXicH2u+ttMOt1kojcsYyCAdD7J4gwh0alG1TtceB9Cz8vfVXNeAhqogPBhnUGSCI5D5nG r/k+BfdGa/qyMZW+x3W9QNOcIDN+w7//+Yqg+WTwSPESXfE+fridz0ORKzf99oBc6dD+Q/5Wl +VWm4lmnCDJ7mlLKMszWCJXxdAfgxTyQIVv/3c0ok3hZfg9Zi+SlplqhSE3iIFy6ZqhACCL5W eus2hvQcQvPnkHf8L8hSDcX74mKQYJzOW5mANnFGnDxX8rqp9vAWUDEE0Y6XrKBHSqU8KFCu8 7YBg7zdpCV7BR73Trh96kD30LI3VZu8fYFgAUmu2aS+gcZx1Gs0vc4pBSU6YbhhrIeCjFbvz8 MuIdYOam1k2VpuK68dMvUQc4g+TXuM6oqV830Nu1/XT0eDeu2cEBjU6P3odW0JVTViFXai2f5 cakfy5nW/pCiCq6jR3q5rVSI6bnBRiGoCht7G2uzf6JzjcB63WyAoRD6aeUMzwpA1Yvdim9Kr f9RHWzkOuOQ7jiX0QxD/tkBnXD6JWurJrI/ZTcZ81AS7uyQLvJVpzl8rNpAr0lLP8eVifZShL jn6yzfukeBNoOBmMxmAkQNwVfsFpZIqhLoVMQKj55iU2KH4+U5K1Tzo9z3gdh24C7x9lwgd9f MYI9UazotpT9R54F7+y6PnTudmIJOCucacaaq60X2tqa/wiTG3gyoP7ZdUu9LLiDagg+ztI4w 9tPIt/A Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 21 Apr 2017 13:50:38 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: kfree(NULL) is safe and this check is probably not required Thus fix the affected source code place. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/mlx4/mad.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index cf33efce69d2..3caf468ca133 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -1962,10 +1962,8 @@ static int alloc_pv_object(struct mlx4_ib_dev *dev, int slave, int port, static void free_pv_object(struct mlx4_ib_dev *dev, int slave, int port) { - if (dev->sriov.demux[port - 1].tun[slave]) { - kfree(dev->sriov.demux[port - 1].tun[slave]); - dev->sriov.demux[port - 1].tun[slave] = NULL; - } + kfree(dev->sriov.demux[port - 1].tun[slave]); + dev->sriov.demux[port - 1].tun[slave] = NULL; } static int create_pv_resources(struct ib_device *ibdev, int slave, int port,