[PATCH] paravirt reorder functions to avoid unspecified behaviour

Andy Whitcroft
2006-11-27T04:21:53Z

paravirt: reorder functions to avoid unspecified behaviour

The paravirt ops introduce a 'weak' attribute onto memory_setup().
Code ordering leads to the following warnings on x86:

arch/i386/kernel/setup.c:651: warning: weak declaration of
`memory_setup' after first use results in unspecified behavior

Move memory_setup() to avoid this.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 8be04da..79df6e6 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -494,6 +494,12 @@ static void set_mca_bus(int x)
static void set_mca_bus(int x) { }
#endif

+/* Overridden in paravirt.c if CONFIG_PARAVIRT */
+char * __attribute__((weak)) memory_setup(void)
+{
+ return machine_specific_memory_setup();
+}
+
/*
* Determine if we were loaded by an EFI loader. If so, then we have also been
* passed the efi memmap, systab, etc., so we should use these data structures
@@ -646,12 +652,6 @@ void __init setup_arch(char **cmdline_p)
tsc_init();
}

-/* Overridden in paravirt.c if CONFIG_PARAVIRT */
-char * __attribute__((weak)) memory_setup(void)
-{
- return machine_specific_memory_setup();
-}
-
static __init int add_pcspkr(void)
{
struct platform_device *pd;