Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162197AbdDUSma (ORCPT ); Fri, 21 Apr 2017 14:42:30 -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 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1472 Lines: 47 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); -- 2.12.2