[U-Boot-Users] [patch] do not use cmd_reset uninitialized in cfi_flash.c

Mike Frysinger vapier at gentoo.org
Tue Jan 29 04:27:05 CET 2008


The cmd_reset member of the flash info struct is not initialized until the
specific cmdset function is called.  This normally happens by:
 flash_get_size -> flash_detect_cfi -> cmdset_*_init
That means we cannot use cmd_reset inside of the cfi detection functions.

Signed-off-by: Sonic Zhang <sonic.zhang at analog.com>
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index eb509f5..eb3f517 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1538,7 +1538,7 @@
 {
 	int cfi_offset;
 
-	flash_write_cmd (info, 0, 0, info->cmd_reset);
+	flash_write_cmd (info, 0, 0, FLASH_CMD_RESET);
 	for (cfi_offset=0;
 	     cfi_offset < sizeof(flash_offset_cfi) / sizeof(uint);
 	     cfi_offset++) {




More information about the U-Boot mailing list