From patchwork Thu Aug 31 08:07:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9931533 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 BC713602F0 for ; Thu, 31 Aug 2017 08:27:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9659288A2 for ; Thu, 31 Aug 2017 08:27:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E306288A6; Thu, 31 Aug 2017 08:27:43 +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 1F4AD288A2 for ; Thu, 31 Aug 2017 08:27:42 +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 1dnKmz-0005rq-AS; Thu, 31 Aug 2017 08:25:25 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnKmx-0005ri-EH for xen-devel@lists.xenproject.org; Thu, 31 Aug 2017 08:25:23 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id BD/46-01777-2F7C7A95; Thu, 31 Aug 2017 08:25:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVywNykQvf98eW RBtP/SFt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnfHx5iLjjEWfFgVxdTA+Mjti5GLg4hgWmM Ei+2zwFyODkkBHgljiybwQph+0sc3rODGaKogVHi9rfFYAk2AXWJx197mEBsEQEliXurJjOBF DELNDFKXDz2HKiDg0NYwFbi584ikBoWAVWJ9j0LwBbwCrhLTLizD2qZnMTJY5NZJzByL2BkWM WoUZxaVJZapGtkqpdUlJmeUZKbmJmja2hgqpebWlycmJ6ak5hUrJecn7uJEejhegYGxh2Mu9r 9DjFKcjApifJGpy6PFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBu/MYUE6wKDU9tSItMwcYajBp CQ4eJRFeT5A0b3FBYm5xZjpE6hSjopQ4bwpIQgAkkVGaB9cGC+9LjLJSwryMDAwMQjwFqUW5m SWo8q8YxTkYlYR5j4FM4cnMK4Gb/gpoMRPQ4livpSCLSxIRUlINjJkmSgVvXc02cN6zLWJ/lV w0aXGBR/dpY7FvSgUNy5OtFBL0u9d+z/4//eLJdR0+bE+MBWb0y05/Y6Ub8NTg1edVraWtlpr 1rY+9Dj7K/Mqv1DapoTGk7Fak8RxW4XSLe9MML2ULCR2oaGeOjskMjfxU6WJpHWKxa+7aT6c/ Fp1ndzD+U8atxFKckWioxVxUnAgAQjRw9GoCAAA= X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1504167917!95669652!1 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52890 invoked from network); 31 Aug 2017 08:25:19 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-15.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 31 Aug 2017 08:25:19 -0000 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Aug 2017 01:25:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,451,1498546800"; d="scan'208";a="144012865" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by orsmga005.jf.intel.com with ESMTP; 31 Aug 2017 01:25:14 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Thu, 31 Aug 2017 16:07:26 +0800 Message-Id: <1504166846-3871-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 Cc: andrew.cooper3@citrix.com, Yi Sun , wei.liu2@citrix.com, jbeulich@suse.com, roger.pau@citrix.com Subject: [Xen-devel] [PATCH 1/2] x86: remove redundant checks in sysctl.c 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 In sysctl.c, the return value of 'psr_get_info' has been checked immediately. So, it is redundant to check the return value again when copy the field to guest. Signed-off-by: Yi Sun Reviewed-by: Jan Beulich Reviewed-by: Roger Pau Monné --- xen/arch/x86/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 2bde99c..c3fdae8 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -190,7 +190,7 @@ long arch_do_sysctl( sysctl->u.psr_cat_op.u.cat_info.flags = data[PSR_INFO_IDX_CAT_FLAG]; - if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) + if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) ret = -EFAULT; break; } @@ -209,7 +209,7 @@ long arch_do_sysctl( sysctl->u.psr_cat_op.u.cat_info.flags = data[PSR_INFO_IDX_CAT_FLAG]; - if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) + if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) ret = -EFAULT; break; }