From nobody Fri May 3 12:44:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1585571085; cv=none; d=zohomail.com; s=zohoarc; b=g2lNL/L4Z192izTG0EpgUb1SgsoZqLdjGJweZ0qRZIacBHLZ2Sf1eXiVgvKNxcqEgrRgjD4iO20X73Q37SuptlFgmZ7gdM6UmKe9nZ4UXWxhdPQPNujoBm7hNM2Cj9wSeqZOZCZ3EHf0vnRiKU23Dw09HMQPRbOiGJWdTac3lKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585571085; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=R+Mvo6YlEZSEXIKSXyFXtHJSEKQK632DZDrO5pcJL88=; b=PS2nIMwZY9VcZCKsUEyxLSJ/vu3rbY1v8/9YAVj/RjK0DB69g/aYUSfb8QowTbB9aMxADSdp2Tchvx3iRTv6PKDrrRYPYBRtC1YZ7+EC6twKUZlpcoGGaZIgyLSqr/K8SqrTiq2lIZtC9aSiY0PjwB+OPDU/NzI2tQNfq5trG1s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585571085382140.4828530998618; Mon, 30 Mar 2020 05:24:45 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jItRn-0002fX-Vh; Mon, 30 Mar 2020 12:23:19 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jItRm-0002fS-SS for xen-devel@lists.xenproject.org; Mon, 30 Mar 2020 12:23:18 +0000 Received: from mail-pf1-x444.google.com (unknown [2607:f8b0:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3c4bf912-7281-11ea-b58d-bc764e2007e4; Mon, 30 Mar 2020 12:23:17 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id k15so3355993pfh.6 for ; Mon, 30 Mar 2020 05:23:17 -0700 (PDT) Received: from simran-Inspiron-5558 ([2409:4052:200b:c71e:714b:a6a2:c67d:105f]) by smtp.gmail.com with ESMTPSA id g81sm10083137pfb.188.2020.03.30.05.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 05:23:15 -0700 (PDT) X-Inumbo-ID: 3c4bf912-7281-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=R+Mvo6YlEZSEXIKSXyFXtHJSEKQK632DZDrO5pcJL88=; b=dty1WsQYVo1AJ4mkUnijL7v5+ZWKOz66ci7aCPCxDo6A3ysctmYN8NbjjD1pythGi8 ptm1pmp8LFvrHGPHnySvmh7JhwRDJcdpIZh3E2Os08ihckP1D7lzt4ToIZTrevKQMd6M WIguUgZo+iu29WtYM29n8ClzR1ptqir1ZJkC4NCsO8k2WLe9hOX8TbJQVz7A/0L7VGH0 B74clDUHTFJaZnOmRuWUdmO3K76TEy2wYVR4QFzLKHiLGl88xJed7eN7U2GmxKNK6cJR TetIKs8IcBEWPxx2Rfutxt9GjTSY7zu+H3KzBVouKjm4qEnw7kp4GghCpZlLN4RKcB2q Oo6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=R+Mvo6YlEZSEXIKSXyFXtHJSEKQK632DZDrO5pcJL88=; b=Kl8iQapUdVA5VsQGhXXwdnoS//2c7DW7c++62rwkrt65MgkHpLVlbxycZEw5XGB5KZ 0lXrMbKkxiGHexf2VR4GfOVOkqrSpCYG7a8B8mr+itwjlAxKG3REGoeLLx4LwwMIM+j+ +bMA/lvaWNU8FuGn5rk8CnW81RZGDqGdv7Ihk26uk59GR8jQjf+6IkEEWUlZRybCpGXh TPiJrHJJzHKCMuMKw/00PytnZ9Qyz9jXwKzKE+rk4tPe/tcfdKjwsBa5YuRM5r9fYP4k Mih7CQ/5+T4oshrgu4BMwHjY6yIljedU5XT+dP5F9okTE06VoyWJd6HWK7bOJ1rzADrn V//g== X-Gm-Message-State: ANhLgQ1ydQqfZUtkt1hMrftt3C5w+iblgtSDAQaPvTdzNSS9tYmCT2bx bMRUDNElPQn1VJMAvto+8pU= X-Google-Smtp-Source: ADFU+vunGFf1powzNR1Rm06pzIHd96j30bTGZKN/qbMdJGiUyPT82nWZGh7vwx7zAnTejfxc7Yu/VQ== X-Received: by 2002:a05:6a00:41:: with SMTP id i1mr13146765pfk.275.1585570996986; Mon, 30 Mar 2020 05:23:16 -0700 (PDT) Date: Mon, 30 Mar 2020 17:53:08 +0530 From: Simran Singhal To: xen-devel@lists.xenproject.org Message-ID: <20200330122308.GA10191@simran-Inspiron-5558> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Subject: [Xen-devel] [PATCH v2] xen/x86: Compress lines for immediate return X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , Roger Pau =?iso-8859-1?Q?Monn=E9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Compress two lines into a single line if immediate return statement is foun= d. It also remove variables retval, freq, effective, vector, ovf and now as they are no longer needed. Signed-off-by: Simran Singhal Acked-by: Jan Beulich Reviewed-by: Wei Liu --- Changes in v2: - Remove variable ovf as it is also not needed. xen/arch/x86/acpi/cpufreq/cpufreq.c | 9 ++------- xen/arch/x86/hvm/mtrr.c | 6 ++---- xen/arch/x86/hvm/vpic.c | 5 ++--- xen/arch/x86/oprofile/op_model_athlon.c | 5 +---- xen/arch/x86/time.c | 5 +---- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufre= q/cpufreq.c index 281be131a3..f1f3c6923f 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -270,7 +270,6 @@ unsigned int get_measured_perf(unsigned int cpu, unsign= ed int flag) struct cpufreq_policy *policy; =20 struct perf_pair readin, cur, *saved; unsigned int perf_percent; - unsigned int retval; =20 if (!cpu_online(cpu)) return 0; @@ -318,16 +317,13 @@ unsigned int get_measured_perf(unsigned int cpu, unsi= gned int flag) else perf_percent =3D 0; =20 - retval =3D policy->cpuinfo.max_freq * perf_percent / 100; - - return retval; + return policy->cpuinfo.max_freq * perf_percent / 100; } =20 static unsigned int get_cur_freq_on_cpu(unsigned int cpu) { struct cpufreq_policy *policy; struct acpi_cpufreq_data *data; - unsigned int freq; =20 if (!cpu_online(cpu)) return 0; @@ -341,8 +337,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cp= u) data->acpi_data =3D=3D NULL || data->freq_table =3D=3D NULL)) return 0; =20 - freq =3D extract_freq(get_cur_val(cpumask_of(cpu)), data); - return freq; + return extract_freq(get_cur_val(cpumask_of(cpu)), data); } =20 static void feature_detect(void *info) diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c index 8356e8de3d..511c3be1c8 100644 --- a/xen/arch/x86/hvm/mtrr.c +++ b/xen/arch/x86/hvm/mtrr.c @@ -317,7 +317,7 @@ static uint8_t effective_mm_type(struct mtrr_state *m, uint32_t pte_flags, uint8_t gmtrr_mtype) { - uint8_t mtrr_mtype, pat_value, effective; + uint8_t mtrr_mtype, pat_value; =20 /* if get_pat_flags() gives a dedicated MTRR type, * just use it @@ -329,9 +329,7 @@ static uint8_t effective_mm_type(struct mtrr_state *m, =20 pat_value =3D page_pat_type(pat, pte_flags); =20 - effective =3D mm_type_tbl[mtrr_mtype][pat_value]; - - return effective; + return mm_type_tbl[mtrr_mtype][pat_value]; } =20 uint32_t get_pat_flags(struct vcpu *v, diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c index 4897a0e05b..61f4b6784c 100644 --- a/xen/arch/x86/hvm/vpic.c +++ b/xen/arch/x86/hvm/vpic.c @@ -484,7 +484,7 @@ void vpic_irq_negative_edge(struct domain *d, int irq) =20 int vpic_ack_pending_irq(struct vcpu *v) { - int irq, vector; + int irq; struct hvm_hw_vpic *vpic =3D &v->domain->arch.hvm.vpic[0]; =20 ASSERT(has_vpic(v->domain)); @@ -498,8 +498,7 @@ int vpic_ack_pending_irq(struct vcpu *v) if ( irq =3D=3D -1 ) return -1; =20 - vector =3D vpic[irq >> 3].irq_base + (irq & 7); - return vector; + return vpic[irq >> 3].irq_base + (irq & 7); } =20 /* diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofil= e/op_model_athlon.c index 5c48f868ae..ee6eb0ecae 100644 --- a/xen/arch/x86/oprofile/op_model_athlon.c +++ b/xen/arch/x86/oprofile/op_model_athlon.c @@ -315,7 +315,6 @@ static int athlon_check_ctrs(unsigned int const cpu, { uint64_t msr_content; int i; - int ovf =3D 0; unsigned long eip =3D regs->rip; int mode =3D 0; struct vcpu *v =3D current; @@ -339,13 +338,11 @@ static int athlon_check_ctrs(unsigned int const cpu, if (CTR_OVERFLOWED(msr_content)) { xenoprof_log_event(current, regs, eip, mode, i); CTR_WRITE(reset_value[i], msrs, i); - ovf =3D 1; } } =20 - ovf =3D handle_ibs(mode, regs); /* See op_model_ppro.c */ - return ovf; + return handle_ibs(mode, regs); } =20 static inline void start_ibs(void) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 2d4430b283..bbaea3aa65 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1142,16 +1142,13 @@ s_time_t get_s_time_fixed(u64 at_tsc) { const struct cpu_time *t =3D &this_cpu(cpu_time); u64 tsc, delta; - s_time_t now; =20 if ( at_tsc ) tsc =3D at_tsc; else tsc =3D rdtsc_ordered(); delta =3D tsc - t->stamp.local_tsc; - now =3D t->stamp.local_stime + scale_delta(delta, &t->tsc_scale); - - return now; + return t->stamp.local_stime + scale_delta(delta, &t->tsc_scale); } =20 s_time_t get_s_time() --=20 2.17.1