From patchwork Fri Jun 23 22:01:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 9807437 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 A82DC6086C for ; Fri, 23 Jun 2017 22:04:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A3562854A for ; Fri, 23 Jun 2017 22:04:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AF5428558; Fri, 23 Jun 2017 22:04:14 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1BDD72854A for ; Fri, 23 Jun 2017 22:04:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOWdq-0008SY-1T; Fri, 23 Jun 2017 22:01:26 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOWdo-0008SS-Ca for xen-devel@lists.xenproject.org; Fri, 23 Jun 2017 22:01:24 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id D9/9F-03620-3BF8D495; Fri, 23 Jun 2017 22:01:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIKsWRWlGSWpSXmKPExsVyYKeppO7mft9 Ig9aT/Bbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b0/TuYClbzVEzb95q1gXENVxcjF4eQwCNG iT/bD7FCOF2MEkvadzFCOJcZJV703QbKcHKwCKhK/JvTA5Tg4GATMJU4v8EUpEZE4CyjxMW2+ YwgNcwCRRKfP2xnArGFBYIlFn98xQpSzyugL/FqRyVImFdAUOLkzCcsEOVaEjf+vWQCKWEWkJ ZY/o8DJCwqoCJxZcJbdhBbQiBK4u/uqywQtrnEq1kn2SBsY4mXrxYwQ9hWEr8Pr2GBiTeu/Q/ VKyDR9uckK4QtI/G0rQfKlpaYt6WVEcLmkjgwdR7UTH6Jw7PvQcX5JPYt3AAVN5NoOrgCqldN YvOOeaww88+9vcgEYbtJ3Hj4kWkCo8wsJF/OQvLlLIQvFzAyr2LUKE4tKkst0jUy0EsqykzPK MlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECIxeBiDYwfhrWcAhRkkOJiVR3tgzPpFCfEn5KZ UZicUZ8UWlOanFhxhlODiUJHhX9/lGCgkWpaanVqRl5gDTCExagoNHSYSXpQwozVtckJhbnJk OkTrFqMvR9W77FyYhlrz8vFQpcd42kBkCIEUZpXlwI2Ap7RKjrJQwLyPQUUI8BalFuZklqPKv GMU5GJWEefVApvBk5pXAbXoFdAQT0BEz1viAHFGSiJCSamBs5fg/Yd7snMJtaesksqPFsrkq/ j3p1vHysU8pc/0Y9vrt2deVL6Y8yf216pFSryX/DYt6o8+25hzxdnujy3TUeJ82OltuK6uUt+ PcOeli3seEcz/av1hZBfGl/XrlP31WqfryqfNYlYWP5ny27t4xZeP6Bh0GlvlL7QWsg4tfitT +bYqL3KnEUpyRaKjFXFScCAAErNbvZAMAAA== X-Env-Sender: garsilva@embeddedor.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1498255282!75319109!1 X-Originating-IP: [192.185.53.25] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7535 invoked from network); 23 Jun 2017 22:01:23 -0000 Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.53.25) by server-11.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Jun 2017 22:01:23 -0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 0B746400D5BE9 for ; Fri, 23 Jun 2017 17:01:22 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id OWdTdsPKwhVbKOWdTd4iSm; Fri, 23 Jun 2017 17:01:03 -0500 Received: from [189.152.192.143] (port=50816 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1dOWdl-001GIt-MY; Fri, 23 Jun 2017 17:01:21 -0500 Date: Fri, 23 Jun 2017 17:01:20 -0500 From: "Gustavo A. R. Silva" To: Boris Ostrovsky , Juergen Gross , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org Message-ID: <20170623220120.GA9015@embeddedgus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - lists.xenproject.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.192.143 X-Exim-ID: 1dOWdl-001GIt-MY X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.192.143]:50816 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 7 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Cc: xen-devel@lists.xenproject.org, "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org Subject: [Xen-devel] [PATCH] x86: xen: remove unnecessary variable in xen_foreach_remap_area() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Remove unnecessary variable mfn in function xen_foreach_remap_area() and, refactor the code. Variable mfn at line 518:mfn = xen_remap_buf.mfns[i]; is only being used to store a value to be passed as an argument to the xen_update_mem_tables() function. This value can be passed directly, which makes variable mfn unnecessary. Also, value assigned to variable mfn at line 534:mfn = xen_remap_mfn; is never used. Addresses-Coverity-ID: 1260110 Signed-off-by: Gustavo A. R. Silva Reviewed-by: Juergen Gross --- arch/x86/xen/setup.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index a5bf7c4..c810463 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -499,7 +499,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, void __init xen_remap_memory(void) { unsigned long buf = (unsigned long)&xen_remap_buf; - unsigned long mfn_save, mfn, pfn; + unsigned long mfn_save, pfn; unsigned long remapped = 0; unsigned int i; unsigned long pfn_s = ~0UL; @@ -515,8 +515,7 @@ void __init xen_remap_memory(void) pfn = xen_remap_buf.target_pfn; for (i = 0; i < xen_remap_buf.size; i++) { - mfn = xen_remap_buf.mfns[i]; - xen_update_mem_tables(pfn, mfn); + xen_update_mem_tables(pfn, xen_remap_buf.mfns[i]); remapped++; pfn++; } @@ -530,8 +529,6 @@ void __init xen_remap_memory(void) pfn_s = xen_remap_buf.target_pfn; len = xen_remap_buf.size; } - - mfn = xen_remap_mfn; xen_remap_mfn = xen_remap_buf.next_area_mfn; }