arch/x86: Remove unnecessary returns from void function()'s
PATCH 1/1 arch/x86: Remove unnecessary returns from void function()'s
This patch removes from arch/x86/ all the unnecessary return; statements that precede the last closing brace of void functions.
It does not remove returns that are immediately
preceded by a label as gcc doesn't like that.
Done via:
$ grep -rPl --include=*.[ch] "return;\n}" arch/x86/ | \
xargs perl -i -e 'local $/ ; while (<>) { s/\n[ \t\n]+return;\n}/\n}/g; print; }'Compile tested x86 allmodconfig only.
--- arch/x86/boot/compressed/misc.c | 1 - arch/x86/include/asm/apic.h | 2 -- arch/x86/kernel/acpi/boot.c | 2 -- arch/x86/kernel/amd_iommu.c | 2 -- arch/x86/kernel/apb_timer.c | 2 -- arch/x86/kernel/apic/io_apic.c | 2 -- arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c | 2 -- arch/x86/kernel/cpu/cpufreq/powernow-k6.c | 2 -- arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 2 -- arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | 2 -- arch/x86/kernel/cpu/cpufreq/speedstep-smi.c | 2 -- arch/x86/kernel/cpu/cyrix.c | 1 - arch/x86/kernel/hpet.c | 2 -- arch/x86/kernel/pci-calgary_64.c | 1 - arch/x86/kernel/quirks.c | 3 --- arch/x86/kernel/reboot_fixups_32.c | 1 - arch/x86/kernel/traps.c | 2 -- arch/x86/kernel/vsmp_64.c | 1 - arch/x86/kvm/mmu.c | 2 -- arch/x86/kvm/x86.c | 1 - arch/x86/lguest/boot.c | 1 - arch/x86/lib/insn.c | 1 - arch/x86/math-emu/fpu_trig.c | 1 - arch/x86/mm/ioremap.c | 1 - arch/x86/xen/enlighten.c | 1 - 25 files changed, 0 insertions(+), 40 deletions(-)
arch/x86/boot/compressed/misc.c +0 -1
@@ -342,5 +342,4 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,parse_elf (output);if (!quiet)putstr ("done.\nBooting the kernel.\n" ); -return ; }
arch/x86/include/asm/apic.h +0 -2
@@ -153,7 +153,6 @@ static inline u32 native_apic_msr_read(u32 reg)static inline void native_x2apic_wait_icr_idle (void ) {/* no need to wait for icr idle in x2apic */ -return ; }static inline u32 native_safe_x2apic_wait_icr_idle (void )
@@ -453,7 +452,6 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert) {while (!atomic_read (deassert))cpu_relax (); -return ; }extern void generic_bigsmp_probe (void );
arch/x86/kernel/acpi/boot.c +0 -2
@@ -340,7 +340,6 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)* and for later update of acpi_gbl_FADT */ acpi_sci_override_gsi = gsi; -return ; } static int __init
@@ -1261,7 +1260,6 @@ static void __init acpi_process_madt(void)printk (KERN_INFO "Using ACPI for processor (LAPIC) " "configuration information\n" );#endif -return ; }static int __init disable_acpi_irq (const struct dmi_system_id *d)
arch/x86/kernel/amd_iommu.c +0 -2
@@ -601,8 +601,6 @@ static void __iommu_flush_pages(struct protection_domain *domain,iommu_queue_inv_iommu_pages (amd_iommus[i], address, domain->id, pde, s); } - -return ; } static void iommu_flush_pages(struct protection_domain *domain,
arch/x86/kernel/apb_timer.c +0 -2
@@ -391,8 +391,6 @@ void apbt_setup_secondary_clock(void)clockevents_register_device (aevt);apbt_enable_int (cpu); - -return ; }/*
arch/x86/kernel/apic/io_apic.c +0 -2
@@ -1742,8 +1742,6 @@ __apicdebuginit(void) print_IO_APIC(void) }printk (KERN_INFO ".................................... done.\n" ); - -return ; }__apicdebuginit (void )print_APIC_field (int base)
arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c +0 -2
@@ -125,8 +125,6 @@ static void nforce2_write_pll(int pll)/* Now write the value in all 64 registers */ for (temp =0 ; temp <=0x3f ; temp++)pci_write_config_dword (nforce2_dev,NFORCE2_PLLREG , pll); - -return ; }/**
arch/x86/kernel/cpu/cpufreq/powernow-k6.c +0 -2
@@ -98,8 +98,6 @@ static void powernow_k6_set_state(unsigned int best_i)wrmsr (MSR_K6_EPMR , msrval,0 );/* disable it again */ cpufreq_notify_transition (&freqs,CPUFREQ_POSTCHANGE ); - -return ; }
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +0 -2
@@ -149,14 +149,12 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)static void count_off_irt (struct powernow_k8_data *data) {udelay ((1 << data->irt) *10 ); -return ; }/* the voltage stabilization time */ static void count_off_vst (struct powernow_k8_data *data) {udelay (data->vstable *VST_UNITS_20US ); -return ; }/* need to init the control msr to a safe value (for each cpu) */
arch/x86/kernel/cpu/cpufreq/speedstep-ich.c +0 -2
@@ -139,8 +139,6 @@ static void speedstep_set_state(unsigned int state) speedstep_get_frequency(speedstep_processor) / 1000); else printk(KERN_ERR "cpufreq: change failed - I/O error\n"); - -return ; }/* Wrapper for smp_call_function_single. */
arch/x86/kernel/cpu/cpufreq/speedstep-smi.c +0 -2
@@ -229,8 +229,6 @@ static void speedstep_set_state(unsigned int state)printk (KERN_ERR "cpufreq: change to state %u " "failed with new_state %u and result %u\n" , state, new_state, result); - -return ; }
arch/x86/kernel/cpu/cyrix.c +0 -1
@@ -349,7 +349,6 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)strcpy (buf, Cx86_model[dir0_msn &7 ]);if (p)strcat (buf, p); -return ; }/*
arch/x86/kernel/hpet.c +0 -2
@@ -744,13 +744,11 @@ static int hpet_setup_msi_irq(unsigned int irq) }static void hpet_msi_capability_lookup (unsigned int start_timer) { -return ; }#ifdef CONFIG_HPET static void hpet_reserve_msi_timers (struct hpet_data *hd) { -return ; }#endif
arch/x86/kernel/pci-calgary_64.c +0 -1
@@ -1341,7 +1341,6 @@ static void __init get_tce_space_from_tar(void) info->tce_space = (u64 *)__va (tce_space); } } -return ; }static int __init calgary_iommu_init (void )
arch/x86/kernel/quirks.c +0 -3
@@ -88,8 +88,6 @@ static void ich_force_hpet_resume(void)BUG (); else printk(KERN_DEBUG "Force enabled HPET at resume\n"); - -return ; }static void ich_force_enable_hpet (struct pci_dev *dev)
@@ -440,7 +438,6 @@ static void nvidia_force_enable_hpet(struct pci_dev *dev)dev_printk (KERN_DEBUG , &dev->dev,"Force enabled HPET at 0x%lx\n" , force_hpet_address); cached_dev = dev; -return ; }/* ISA Bridges */
arch/x86/kernel/reboot_fixups_32.c +0 -1
@@ -20,7 +20,6 @@ static void cs5530a_warm_reset(struct pci_dev *dev)cs5530a to perform a system warm reset */ pci_write_config_byte (dev,0x44 ,0x1 );udelay (50 );/* shouldn't get here but be safe and spin-a-while */ -return ; }static void cs5536_warm_reset (struct pci_dev *dev)
arch/x86/kernel/traps.c +0 -2
@@ -581,8 +581,6 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)if (tsk->thread.debugreg6 & (DR_STEP |DR_TRAP_BITS ))send_sigtrap (tsk, regs, error_code, si_code);preempt_conditional_cli (regs); - -return ; }#ifdef CONFIG_X86_64
arch/x86/kernel/vsmp_64.c +0 -1
@@ -156,5 +156,4 @@ void __init vsmp_init(void)return ;set_vsmp_pv_ops (); -return ; }
arch/x86/kvm/mmu.c +0 -2
@@ -3218,7 +3218,6 @@ static void mmu_spte_walk(struct kvm_vcpu *vcpu, inspect_spte_fn fn)__mmu_spte_walk (vcpu->kvm, sp, fn); } } -return ; } static void audit_mappings_page(struct kvm_vcpu *vcpu, u64 page_pte,
@@ -3376,7 +3375,6 @@ static void check_writable_mappings_rmap(struct kvm_vcpu *vcpu)inspect_spte_has_rmap (vcpu->kvm, sp, &pt[i]); } } -return ; }static void audit_rmap (struct kvm_vcpu *vcpu)
arch/x86/kvm/x86.c +0 -1
@@ -478,7 +478,6 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) vcpu->arch.cr0 = cr0;kvm_mmu_reset_context (vcpu); -return ; }EXPORT_SYMBOL_GPL (kvm_set_cr0);
arch/x86/lguest/boot.c +0 -1
@@ -1077,7 +1077,6 @@ static void lguest_apic_icr_write(u32 low, u32 id)static void lguest_apic_wait_icr_idle (void ) { -return ; }static u32 lguest_apic_safe_wait_icr_idle (void )
arch/x86/lib/insn.c +0 -1
@@ -158,7 +158,6 @@ vex_end: insn->vex_prefix.got =1 ; prefixes->got =1 ; -return ; }/**
arch/x86/math-emu/fpu_trig.c +0 -1
@@ -173,7 +173,6 @@ static void convert_l2reg(long const *arg, int deststnr) tag =FPU_normalize (dest);FPU_settagi (deststnr, tag);setsign (dest, sign); -return ; }static void single_arg_error (FPU_REG *st0_ptr,u_char st0_tag)
arch/x86/mm/ioremap.c +0 -1
@@ -332,7 +332,6 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr)return ;iounmap ((void __iomem *)((unsigned long )addr &PAGE_MASK )); -return ; }static int __initdata early_ioremap_debug;
arch/x86/xen/enlighten.c +0 -1
@@ -711,7 +711,6 @@ static void xen_apic_icr_write(u32 low, u32 id)static void xen_apic_wait_icr_idle (void ) { -return ; }static u32 xen_safe_apic_wait_icr_idle (void )
H. Peter Anvin
reviewerQuoted 6 lines · Joe Perches
This patch removes from
arch/x86/all the unnecessary return; statements that precede the last closing brace of void functions.It does not remove returns that are immediately
preceded by a label as gcc doesn't like that.
And the point of this is?
I fail to see how this improves the clarity of the code one iota, and isn't anything but just churn.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 7 lines · H. Peter Anvin
Quoted 3 lines · Joe Perches
This patch removes from
arch/x86/all the unnecessary return; statements that precede the last closing brace of void functions.And the point of this is?
I fail to see how this improves the clarity of the code one iota, and isn't anything but just churn.
Just naked consistency.
Most all kernel void functions don't use return before the closing brace.
The good thing about code removal is it doesn't make any impact on git blame.
Ignore it or not. No worries to me.
Quoted 10 lines · Joe Perches
Quoted 7 lines · H. Peter Anvin
Quoted 3 lines · Joe Perches
This patch removes from
arch/x86/all the unnecessary return; statements that precede the last closing brace of void functions.And the point of this is?
I fail to see how this improves the clarity of the code one iota, and isn't anything but just churn.Most all kernel void functions don't use return before the closing brace.
Just a stat from arch/x86:
There may be a little over 2000 void functions in arch/x86/, 40 use returns before the trailing brace.
Call it churn or consistency, <shrug>.
cheers, Joe
H. Peter Anvin
reviewerQuoted 8 lines · Joe Perches
Just a stat from
arch/x86:There may be a little over 2000 void functions in
arch/x86/, 40 use returns before the trailing brace.Call it churn or consistency, <shrug>.
No, please get something straight:
Consistency is not an end in itself. Readability is, however.
Avoiding churn, however, is *also* an end in itself. Sometimes churn is motivated by an increase in readability. Churn is *not* motivated just for "consistency" unless it improves readability.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 2 lines · H. Peter Anvin
Churn is *not* motivated just
for "consistency" unless it improves readability.
Consistency improves readability.
H. Peter Anvin
reviewerQuoted 5 lines · Joe Perches
Quoted 2 lines · H. Peter Anvin
Churn is *not* motivated just
for "consistency" unless it improves readability.Consistency improves readability.
As a general rule, sure. For any specific instance it is a big "it depends".
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 8 lines · H. Peter Anvin
Quoted 4 lines · Joe Perches
Quoted 2 lines · H. Peter Anvin
Churn is *not* motivated just
for "consistency" unless it improves readability.Consistency improves readability.
As a general rule, sure.
For any specific instance it is a big "it
depends".
In these specific instances, in my opinion it does. Your assertion is simply your opinion.
In the end, neither opinion matters much.
cheers, Joe