]> xenbits.xensource.com Git - xen.git/commitdiff
x86: compress lines for immediate return
authorSimran Singhal <singhalsimran0@gmail.com>
Tue, 31 Mar 2020 06:51:21 +0000 (08:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 31 Mar 2020 06:51:21 +0000 (08:51 +0200)
Compress two lines into a single line if immediate return statement is found.
It also remove variables retval, freq, effective, vector, ovf and now
as they are no longer needed.

Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
Reviewed-by: Wei Liu <wl@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/acpi/cpufreq/cpufreq.c
xen/arch/x86/hvm/mtrr.c
xen/arch/x86/hvm/vpic.c
xen/arch/x86/oprofile/op_model_athlon.c
xen/arch/x86/time.c

index 281be131a35065b26331cd872ab7523b8dd4abb6..f1f3c6923fb37f27d6aae93ce6d1cba5f1f23c24 100644 (file)
@@ -270,7 +270,6 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
     struct cpufreq_policy *policy;    
     struct perf_pair readin, cur, *saved;
     unsigned int perf_percent;
-    unsigned int retval;
 
     if (!cpu_online(cpu))
         return 0;
@@ -318,16 +317,13 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
     else
         perf_percent = 0;
 
-    retval = policy->cpuinfo.max_freq * perf_percent / 100;
-
-    return retval;
+    return policy->cpuinfo.max_freq * perf_percent / 100;
 }
 
 static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
 {
     struct cpufreq_policy *policy;
     struct acpi_cpufreq_data *data;
-    unsigned int freq;
 
     if (!cpu_online(cpu))
         return 0;
@@ -341,8 +337,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
         data->acpi_data == NULL || data->freq_table == NULL))
         return 0;
 
-    freq = extract_freq(get_cur_val(cpumask_of(cpu)), data);
-    return freq;
+    return extract_freq(get_cur_val(cpumask_of(cpu)), data);
 }
 
 static void feature_detect(void *info)
index 8356e8de3dd71c9f03e345a98b0778332cef9f8c..511c3be1c842fd3d245ba71c43127d27eb3484cd 100644 (file)
@@ -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;
    
     /* 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,
 
     pat_value = page_pat_type(pat, pte_flags);
 
-    effective = mm_type_tbl[mtrr_mtype][pat_value];
-
-    return effective;
+    return mm_type_tbl[mtrr_mtype][pat_value];
 }
 
 uint32_t get_pat_flags(struct vcpu *v,
index 4897a0e05b043a28e37f82fdef532c06976bc08e..61f4b6784c1f8a3fedd8353307181248fa1d89e5 100644 (file)
@@ -484,7 +484,7 @@ void vpic_irq_negative_edge(struct domain *d, int irq)
 
 int vpic_ack_pending_irq(struct vcpu *v)
 {
-    int irq, vector;
+    int irq;
     struct hvm_hw_vpic *vpic = &v->domain->arch.hvm.vpic[0];
 
     ASSERT(has_vpic(v->domain));
@@ -498,8 +498,7 @@ int vpic_ack_pending_irq(struct vcpu *v)
     if ( irq == -1 )
         return -1;
 
-    vector = vpic[irq >> 3].irq_base + (irq & 7);
-    return vector;
+    return vpic[irq >> 3].irq_base + (irq & 7);
 }
 
 /*
index 5c48f868ae72a281c54d45ace71c162a1f102a57..ee6eb0ecae79a46c82e2e61f622ebf53f11a1f6f 100644 (file)
@@ -315,7 +315,6 @@ static int athlon_check_ctrs(unsigned int const cpu,
 {
        uint64_t msr_content;
        int i;
-       int ovf = 0;
        unsigned long eip = regs->rip;
        int mode = 0;
        struct vcpu *v = 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 = 1;
                }
        }
 
-       ovf = handle_ibs(mode, regs);
        /* See op_model_ppro.c */
-       return ovf;
+       return handle_ibs(mode, regs);
 }
 
 static inline void start_ibs(void)
index 2d4430b283c9c8e1143995226eba88538047a3a1..bbaea3aa65f59c826a4ab5d23e27f9efb301809f 100644 (file)
@@ -1142,16 +1142,13 @@ s_time_t get_s_time_fixed(u64 at_tsc)
 {
     const struct cpu_time *t = &this_cpu(cpu_time);
     u64 tsc, delta;
-    s_time_t now;
 
     if ( at_tsc )
         tsc = at_tsc;
     else
         tsc = rdtsc_ordered();
     delta = tsc - t->stamp.local_tsc;
-    now = t->stamp.local_stime + scale_delta(delta, &t->tsc_scale);
-
-    return now;
+    return t->stamp.local_stime + scale_delta(delta, &t->tsc_scale);
 }
 
 s_time_t get_s_time()