Skip to contentSkip to conversation

initialize variables to reduce i386 warnings

PATCH In review Ameer Armaly 3 participants 3 messages May 20, 2006 – May 21, 2006 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initialize variables to reduce i386 warnings

Initialized cpu_freq in arch/i386/kernel/cpu/transmeta.c to suppress warning.

arch/i386/kernel/cpu/transmeta.c +1 -1
index 7214c9b..0737890 100644
@@ -9,7 +9,7 @@ static void __init init_transmeta(struct
 {
 	unsigned int cap_mask, uk, max, dummy;
 	unsigned int cms_rev1, cms_rev2;
-	unsigned int cpu_rev, cpu_freq, cpu_flags, new_cpu_rev;
+	unsigned int cpu_rev, cpu_freq = 0, cpu_flags, new_cpu_rev;
 	char cpu_info[65];
 
 	get_model_name(c);	/* Same as AMD/Cyrix */

!-------------------------------------------------------------flip-

More variable initializations to get rid of warnings.

arch/i386/kernel/apm.c +1 -1
index df0e174..39838a1 100644
@@ -1063,7 +1063,7 @@ #if defined(CONFIG_APM_DISPLAY_BLANK) &&
 
 static int apm_console_blank(int blank)
 {
-	int error, i;
+	int error = 0, i;
 	u_short state;
 	static const u_short dev[3] = { 0x100, 0x1FF, 0x101 };
 
arch/i386/kernel/efi.c +2 -2
index 9202b67..3a7e485 100644
@@ -270,8 +270,8 @@ void efi_memmap_walk(efi_freemem_callbac
 {
 	int prev_valid = 0;
 	struct range {
-		unsigned long start;
-		unsigned long end;
+		unsigned long start = 0;
+		unsigned long end = 0;
 	} prev, curr;
 	efi_memory_desc_t *md;
 	unsigned long start, end;

!-------------------------------------------------------------flip-

#1 lore raw
Quoted 6 lines · you

Initialized cpu_freq in arch/i386/kernel/cpu/transmeta.c to suppress warning.

index 9202b67..3a7e485 100644

arch/i386/kernel/efi.c void efi_memmap_walk(efi_freemem_callbac · line 275

Quoted 8 lines
arch/i386/kernel/efi.c +2 -2
@@ -270,8 +270,8 @@ void efi_memmap_walk(efi_freemem_callbac
  {
  	int prev_valid = 0;
  	struct range {
-		unsigned long start;
-		unsigned long end;
+		unsigned long start = 0;
+		unsigned long end = 0;
  	} prev, curr;

Did you actually try to compile the stuff before submission?

#2 lore raw
In reply to Ameer Armaly
Quoted 2 lines · Ameer Armaly

Initialized cpu_freq in arch/i386/kernel/cpu/transmeta.c to suppress warning.

Urgh.

Doing this just to silence gcc is wrong. I know we've done this at times in the past and that's still not right (I would argue those should be reverted even).

arch/i386/kernel/efi.c void efi_memmap_walk(efi_freemem_callbac · line 274

Quoted 5 lines
arch/i386/kernel/efi.c +2 -2
 	struct range {
-		unsigned long start;
-		unsigned long end;
+		unsigned long start = 0;
+		unsigned long end = 0;

?