From patchwork Sat Feb 18 21:02:58 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: 9581283 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 7BB66600F6 for ; Sat, 18 Feb 2017 21:09:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B29228745 for ; Sat, 18 Feb 2017 21:09:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DA852877A; Sat, 18 Feb 2017 21:09:50 +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 135D528745 for ; Sat, 18 Feb 2017 21:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753991AbdBRVJs (ORCPT ); Sat, 18 Feb 2017 16:09:48 -0500 Received: from mout.web.de ([212.227.15.3]:57575 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753492AbdBRVJr (ORCPT ); Sat, 18 Feb 2017 16:09:47 -0500 Received: from [192.168.1.2] ([77.181.107.93]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MJ1Nh-1cdHPp1qPp-002TUJ; Sat, 18 Feb 2017 22:03:00 +0100 Subject: [PATCH 14/29] IB/mlx4: Delete an unnecessary variable in __mlx4_ib_query_gid() 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: Date: Sat, 18 Feb 2017 22:02:58 +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:0AKf7F9aRXoXDB0UdwIdozLZnZztIEjHybT5Td1n2PiSM1r2PRj QY+jQX4Xd3UFtp7Q82U9mRAX0R8e72DqycrmkADnkPey5Yt8Au2PdAWYuV7gx+jUrqdVWDL IJPiiWCeqg/yO3+674xYJS7xiyn/OfA4+QVCvgdhb1s1vzHAvxDOshEU+kemTwkJ58licm7 rs8BWt0WR2jdwxUY5N0Mg== X-UI-Out-Filterresults: notjunk:1; V01:K0:qnka0oCmLi4=:R7/su6Yg6Yo+mreMtLgwZs YWJ4+3gYEq43JuJxEywLiXfEIJF8iAyRJwUMVfpOeECsmlq+9evPspF82G45QvL4s6wjIp314 w8xOmM99EUvj/g/+XEQeqX9awICsM/lrme+x+39Nb++M0e7gc6qRenqykiqGTUoMmpQytNN+u kyuwFPARb9F3PeNfBffU+gEJtLzaxY+D/xl3cxAp+AA53R3T6GdFDamn97lA6I/APPOXbXUXn FnD3XEWuRF31QJ/ynRkzItVt+WpUe8FCYma3MTQ5LYmDOx26IZ11H7/7+YyPFfCzqwCTz64xZ z7fbnsi0hvcET4r0STFpydvoJLRLUcqRpiGFZv041c5PAo26o42pGZ0j3Bcw7+Fm3mzNGwhAz 1aI6xW2Hia0kCxfHPmZuoIbG/iCxibKB1ZLE5wfPGz4tLVZeGUIZG7U6GNa1MMHpDXsQwsasz 42oFKdGToErDL3YaPBv+NIyMpjJn52WbckcfJ3wlHoAJugokYTdW9PuGINCFnbWckUjA+221g 8J/0sDTRjU2T+yFg1X3TZYgrqRM33WM3HQ8X3tcON4I+fCh4H1fhkNJCdT5N5obpvR0acTZjS IFBE4BbYAwS5BLIkcukjOS9Tbj1xW2Lj33KWAnPZkU+reO5QGHPO5DlARORMq+kKBvwoKsd2i 5rmHnkK+iksm9WYAgVfCs4Ee8HFArryxPk6ke49slSjGLFjM5r+ER+0bVnUzr+ia0Z+sriXms kMkCId6rmVzLJlCJKVi9I4b8aoEC5RTDCLUdS1TqwDjSaeZ13TAQEHrSr/ZqzVP6B5MPyZAnO qX6CFvY 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: Sat, 18 Feb 2017 15:04:50 +0100 * 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 c0c299ffa0f6..89bbb61d62f5 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -777,7 +777,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); @@ -806,8 +805,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; } } @@ -824,8 +823,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);