From patchwork Wed Jun 15 00:41:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 9177179 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 5B12A60772 for ; Wed, 15 Jun 2016 00:43:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49FCF200E7 for ; Wed, 15 Jun 2016 00:43:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CC262833B; Wed, 15 Jun 2016 00:43:19 +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, UNPARSEABLE_RELAY 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 19FB3200E7 for ; Wed, 15 Jun 2016 00:43:17 +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 1bCytF-0007jt-TI; Wed, 15 Jun 2016 00:41:05 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCytF-0007jn-Dk for xen-devel@lists.xen.org; Wed, 15 Jun 2016 00:41:05 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id EC/82-30266-024A0675; Wed, 15 Jun 2016 00:41:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKLMWRWlGSWpSXmKPExsUyZ7p8oK7CkoR wgxNXeC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozD23YzFzSyV7QuuMDewLiatYuRi0NIoINJ 4smj22wQzjdGiVfda6GcjYwSB+a1MkM43YwSffNnAPVwcrAJ6EhMO3CKBSQhItDGKLFgyl1mk ISwQJzErK9HGEFsFgFViYczdjCB2LwC7hIXl+wBa5YQkJM4eWwylG0s0Terj2UCI/cCRoZVjO rFqUVlqUW6hnpJRZnpGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIFeZgCCHYw7nzsdYpT kYFIS5RXOSQgX4kvKT6nMSCzOiC8qzUktPsQow8GhJMF7bBFQTrAoNT21Ii0zBxhuMGkJDh4l Ed7TIGne4oLE3OLMdIjUKUZdjgU/bq9lEmLJy89LlRLnTQApEgApyijNgxsBC/1LjLJSwryMQ EcJ8RSkFuVmlqDKv2IU52BUEuZ9ADKFJzOvBG7TK6AjmICOsJkeD3JESSJCSqqBMbH4zWGhBc uf88s+dvJTsOC5wP/1UENF6usn5kGTLvQu4dunP8vWIzf83L8Nl01m2ElEfzEuMPp3esP7DdJ lWs7GCZNP3fgaZWF2yVZ2lXHxO70MYZHlB3xXHwjYG7osKyn6vZXLiReBneKa8yazHP7JfT0g Q8t3dsEc6xOL4xOvXL/5RftlvhJLcUaioRZzUXEiAPYpnGh4AgAA X-Env-Sender: dongli.zhang@oracle.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1465951262!19062550!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44506 invoked from network); 15 Jun 2016 00:41:03 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-7.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Jun 2016 00:41:03 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u5F0ewjT017510 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 Jun 2016 00:40:59 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u5F0ewS5024179 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 Jun 2016 00:40:58 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u5F0es6q006272; Wed, 15 Jun 2016 00:40:55 GMT Received: from linux.cn.oracle.com (/10.182.70.252) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 Jun 2016 17:40:53 -0700 From: Dongli Zhang To: xen-devel@lists.xen.org, konrad.wilk@oracle.com, ross.lagerwall@citrix.com, ian.jackson@eu.citrix.com, wei.liu2@citrix.com Date: Wed, 15 Jun 2016 08:41:18 +0800 Message-Id: <1465951278-17811-1-git-send-email-dongli.zhang@oracle.com> X-Mailer: git-send-email 1.9.1 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Subject: [Xen-devel] [PATCH v2 1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); " 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Local variable "j" would be used only when "i == ARRAY_SIZE(main_options)" is true. Thus, it is not necessary to update "j" when "i == ARRAY_SIZE(main_options)" is false. Signed-off-by: Dongli Zhang --- tools/misc/xen-livepatch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c index 28f339a..62c072e 100644 --- a/tools/misc/xen-livepatch.c +++ b/tools/misc/xen-livepatch.c @@ -412,7 +412,7 @@ struct { int main(int argc, char *argv[]) { - int i, j, ret; + int i, j = 0, ret; if ( argc <= 1 ) { @@ -435,8 +435,7 @@ int main(int argc, char *argv[]) "'xen-livepatch help'\n", argv[1]); return 1; } - } else - j = ARRAY_SIZE(action_options); + } xch = xc_interface_open(0,0,0); if ( !xch )