From patchwork Sat Feb 18 20:56:17 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: 9581329 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 34B446049F for ; Sat, 18 Feb 2017 21:27:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2315127BE5 for ; Sat, 18 Feb 2017 21:27:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 150F6286BD; Sat, 18 Feb 2017 21:27:59 +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 9331027BE5 for ; Sat, 18 Feb 2017 21:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753991AbdBRV15 (ORCPT ); Sat, 18 Feb 2017 16:27:57 -0500 Received: from mout.web.de ([212.227.15.4]:52182 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753577AbdBRV14 (ORCPT ); Sat, 18 Feb 2017 16:27:56 -0500 Received: from [192.168.1.2] ([77.181.107.93]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lzrwh-1cJtxp3xTP-0150Na; Sat, 18 Feb 2017 21:56:19 +0100 Subject: [PATCH 08/29] IB/mlx4: Delete an unnecessary check before the function call "kfree" in free_pv_object() To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Leon Romanovsky , Matan Barak , Sean Hefty , Yishai Hadas References: <1935365a-bd7c-461e-6a84-0c5d3a501fff@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <1070bd22-757a-e0c9-551d-44c31f5c11cc@users.sourceforge.net> Date: Sat, 18 Feb 2017 21:56:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1935365a-bd7c-461e-6a84-0c5d3a501fff@users.sourceforge.net> X-Provags-ID: V03:K0:jcIMAZDh7ZZjCNaLqA4Nf1rJSXBPndavzpJGqKsy1CvD/xblL/3 Smz2fXbP0ggPiRyXUd6hHYdXtSEyMB7GFwG5OXsB/KzvfyvbdM6BZO/D8VXxd82TURNkNQ4 nogE4ggUCQWQHfKPdNykRR3m0EEneQwNjL5wXY1GioWMeOE0vV/cQP6Lu7AopQtblldV5Zn 8yKx1nEWvRYOEs8V80LtA== X-UI-Out-Filterresults: notjunk:1; V01:K0:nHsYjic8ovs=:/Tezv5EeRU/8fXgJsTgDGX qjnZyIJ9DAiL9ZqNd6bQ93SnuE6xEj8WzYduMKaavSg/QnatAUAI5i9fAkOiEpRRYSFbseX5b s/5TU04vpxSUpQ1ekzQO11z9sWQ2gWp207mycq7BfDOocjvDyY0cuR+jLG7tMqw+AgDl9xIPE GXZ1eyxauMHOAW7Lu//O8G5ZPK3DeP+i3MUNv5Lj/3UWT0sqBuAgJo4CHCZCYeieIsCAleVEW SAfoYfkCvFRuwiTnpYcS6umIq2SN26M0EYhEgjYnvGNEdU8BMKYDx6EY6NqB2RQlex0DS9p+I NtovfBFJ2B2mIS8gJmTq7uk6TqS/rL8AIugQ28fovJMGr1icb2rEPwwpyGGbv+v0+Koe+mDlW uvDZen/TgK7O/88W0b03Ss0YFw8h5CEu9vc061UcLFcTmu0j/NCQ/s6TvfopZhBZSJKHUIKy5 Z7/yrsdMIZdEavjfBmEvvf9irRaUQDNmczsAyDOutEAEHouY9ZSCWhs1GB3T7LOfPPe4vawLX qcIKQbGNQ6Ns0Ky+aMZ0vNTjkHsm8VilQYMn7Gwr79uu9QU+JfNxm9ua3oUKI+2/sv72gC7fx Unii+CuE0zLeTuDu2sQq/ulVyB78Rt+pGDL5s4HcJwl6RBh6qHjCJPjRmZlGckoyPLrDx/L29 pXGcQUv7HfFWDHMCxxj95+iswrZQVSuJrx2iihBnmKKLN3lMhQ/Wb7kdhCz/VW15497ssjVrE j7mnm1AaV+aC4n6lQMbYcb1/Th3CfT3qjzR2Z981UlC7o3nECoREDhwuLp94GngdnsdKLThTw XXvfvhO 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, 17 Feb 2017 22:06:24 +0100 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 75b6522b3a8f..9518b7244269 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -1966,10 +1966,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,