[PATCH 2/2] ppc64: fix warning in arch/ppc64/kernel/nvram.c

Arnd Bergmann arnd at arndb.de
Fri Apr 22 16:54:38 EST 2005


gcc-3.4 warns about part being possibly used without initialization
in nvram_create_os_partition. Converting the function to use 
list_for_each_entry fixes this.

Signed-off-by: Arnd Bergmann <arnd at arndb.de>

--- linus-2.5.orig/arch/ppc64/kernel/nvram.c	2005-04-22 08:05:39.000000000 +0200
+++ linus-2.5/arch/ppc64/kernel/nvram.c	2005-04-22 08:07:16.000000000 +0200
@@ -332,9 +332,8 @@
  */
 static int nvram_create_os_partition(void)
 {
-	struct list_head * p;
 	struct nvram_partition * part;
-	struct nvram_partition * new_part = NULL;
+	struct nvram_partition * new_part;
 	struct nvram_partition * free_part = NULL;
 	int seq_init[2] = { 0, 0 };
 	loff_t tmp_index;
@@ -343,8 +342,7 @@
 	
 	/* Find a free partition that will give us the maximum needed size 
 	   If can't find one that will give us the minimum size needed */
-	list_for_each(p, &nvram_part->partition) {
-		part = list_entry(p, struct nvram_partition, partition);
+	list_for_each_entry(part, &nvram_part->partition, partition) {
 		if (part->header.signature != NVRAM_SIG_FREE)
 			continue;
 



More information about the Linuxppc64-dev mailing list