From patchwork Fri Apr 21 18:42:14 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: 9693477 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 7DB3E6038E for ; Fri, 21 Apr 2017 18:43:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72A5E28660 for ; Fri, 21 Apr 2017 18:43:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 675CA28668; Fri, 21 Apr 2017 18:43:17 +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 1969D28660 for ; Fri, 21 Apr 2017 18:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1042017AbdDUSm3 (ORCPT ); Fri, 21 Apr 2017 14:42:29 -0400 Received: from mout.web.de ([212.227.15.3]:63279 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1041602AbdDUSmZ (ORCPT ); Fri, 21 Apr 2017 14:42:25 -0400 Received: from [192.168.1.2] ([77.182.39.184]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M8oFY-1crmgW3UeS-00C8Y4; Fri, 21 Apr 2017 20:42:16 +0200 Subject: [PATCH v2 10/17] IB/mlx4: Delete an unnecessary variable in __mlx4_ib_query_gid() 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: <823e7d21-4d14-dbab-0499-80ca965dee31@users.sourceforge.net> Date: Fri, 21 Apr 2017 20:42:14 +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:fclIC6m68EM63AiT8co6qbUSuMgoxozouUSdzJinSMnrSd3M+BX 1tuAoiUf6Aew0CPTkfGB4iaW5lnGOg2DTdkKGGXU+ZFxh1Tdz8hE+/a3SNmedTxtAl/biOu nhs5pkYXhmTMUtVpkPcbBSov+wur/isKhQZ5neE6XXv2O+qWkt6yunoRTqNm8fRNl7zkB6v ONWxaUj0SgizXIg6EuLdg== X-UI-Out-Filterresults: notjunk:1; V01:K0:U6h4Q4qjbdM=:dRMfySWWMNG5RoP2k85oAT 1hHE67yITf1/54YjJCzQDGpElzoOJgajrCRHJq4W86EjHidkjP6NDBkw17g/5q7IYbHFOXIt0 wO7Y0IidCDiP6zlSmHXsAn/EjZJY3nRW5K9yiXyrxGLjV5wlS+4toCqgySmz1CNzkcooTCakq CPGI8n4SlpP3yRrh9SjQWvVnwUMHElGEyeJNw/C975P9jWivw4si6y+sYC7q8QgNMQlbVU3ew ppifEqlvmk5Uq3ZOGYt+9gPeM4G3YpPDpOxm4VPX67+KpJkJKYZ4bIZtd7rQV+sVeSoCB7VEc Yk0+O8KTIRG+KSSIlCuV7MeokFcYzD1leSLy5WrpJUd53JFVjcVE5/YPn06gH0utgh4yvkjVK iWCZCefKRogT/pDXSJ6anN7DoE2jUvBjARitz3frQZODNu50ebK8gkqKmNZFO3vRbMFuzT+ZT xGFbYRjaYoDo+lvJ3oRfSPC4AdmRzszGxWjWwjOcWI55aLvbVsMNQG00+gh+yI4Sl5Osz8Ka6 QhdSSjOFo1xl8+ZWyEJvrToIH6UfKCuMqteodq4q+4nyX8wSON+Z4ojKPyiEQpIG8+qhT/p/1 +lGICKwzxhT+jU+zFTV6Zj+5i0+973KmwSJheENSbP2gtsr/vW+6MmJbNJvS/1mOBsmmI7Dfv M8CeQYcNCnAJB1V1kTaY9uWDpe7IDp8amXWBC8C6FzEJKze8uDvkNoNL7wKyI9q3H57L4/KUH jo2KtJ6Kl7EwD3XtVSfrwpy4W1e/VjtKUv8ucWmUxoCRUQrykxXyTNtuBHivTjbFTb9DFEeFN UT5Aljg 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 18:22:42 +0200 * Call the function "memset" directly in an if branch without using an intermediate variable. * Delete the local variable "clear" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/mlx4/main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index e18e46a68809..a54e2f04929b 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -780,7 +780,6 @@ int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index, struct ib_smp *out_mad; int err; struct mlx4_ib_dev *dev = to_mdev(ibdev); - int clear = 0; int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS; in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL); @@ -809,8 +808,8 @@ int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index, if (mlx4_is_mfunc(dev->dev) && !netw_view) { if (index) { /* For any index > 0, return the null guid */ + memset(gid->raw + 8, 0, 8); err = 0; - clear = 1; goto out; } } @@ -827,8 +826,6 @@ int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index, memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8); out: - if (clear) - memset(gid->raw + 8, 0, 8); kfree(out_mad); free_in_mad: kfree(in_mad);