Patchwork [U-Boot,04/14] board/cray/L1/flash.c: Fix GCC 4.6 build warning

login
register
mail settings
Submitter Wolfgang Denk
Date Nov. 30, 2011, 8:17 a.m.
Message ID <1322641077-829-5-git-send-email-wd@denx.de>
Download mbox | patch
Permalink /patch/128436/
State Accepted
Commit fc4df325dc90d194428cb188e24abf6aae48dc50
Headers show

Comments

Wolfgang Denk - Nov. 30, 2011, 8:17 a.m.
Fix:
flash.c: In function 'flash_erase':
flash.c:276:24: warning: variable 'l_sect' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Wolfgang Denk <wd@denx.de>
---
total: 0 errors, 0 warnings, 49 lines checked
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE

 board/cray/L1/flash.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)
Marek Vasut - Dec. 1, 2011, 10:10 p.m.
> Fix:
> flash.c: In function 'flash_erase':
> flash.c:276:24: warning: variable 'l_sect' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> ---
> total: 0 errors, 0 warnings, 49 lines checked
> NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> MULTISTATEMENT_MACRO_USE_DO_WHILE
> 
>  board/cray/L1/flash.c |   25 +++++++++++--------------
>  1 files changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/board/cray/L1/flash.c b/board/cray/L1/flash.c
> index a3d893e..77a2100 100644
> --- a/board/cray/L1/flash.c
> +++ b/board/cray/L1/flash.c
> @@ -273,7 +273,7 @@ int	flash_erase (flash_info_t *info, int s_first, 
int
> s_last) {
>  	volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *)(info->start[0]);
>  	volatile FLASH_WORD_SIZE *addr2;
> -	int flag, prot, sect, l_sect;
> +	int flag, prot, sect;
> 
>  	if ((s_first < 0) || (s_first > s_last)) {
>  		if (info->flash_id == FLASH_UNKNOWN) {
> @@ -303,16 +303,14 @@ int	flash_erase (flash_info_t *info, int s_first, 
int
> s_last) printf ("\n");
>  	}
> 
> -	l_sect = -1;
> -
>  	/* Disable interrupts which might cause a timeout here */
>  	flag = disable_interrupts();
> 
>  	/* Start erase on unprotected sectors */
>  	for (sect = s_first; sect<=s_last; sect++) {
>  		if (info->protect[sect] == 0) {	/* not protected */
> -		    addr2 = (FLASH_WORD_SIZE *)(info->start[sect]);
> -		    printf("Erasing sector %p\n", addr2);
> +			addr2 = (FLASH_WORD_SIZE *)(info->start[sect]);
> +			printf("Erasing sector %p\n", addr2);
> 
>  			addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
>  			addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
> @@ -320,15 +318,14 @@ int	flash_erase (flash_info_t *info, int s_first, 
int
> s_last) addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
>  			addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
>  			addr2[0] = (FLASH_WORD_SIZE)0x00300030;  /* sector erase 
*/
> -		    l_sect = sect;
> -		    /*
> -		     * Wait for each sector to complete, it's more
> -		     * reliable.  According to AMD Spec, you must
> -		     * issue all erase commands within a specified
> -		     * timeout.  This has been seen to fail, especially
> -		     * if printf()s are included (for debug)!!
> -		     */
> -		    wait_for_DQ7(info, sect);
> +			/*
> +			 * Wait for each sector to complete, it's more
> +			 * reliable.  According to AMD Spec, you must
> +			 * issue all erase commands within a specified
> +			 * timeout.  This has been seen to fail, especially
> +			 * if printf()s are included (for debug)!!
> +			 */
> +			wait_for_DQ7(info, sect);
>  		}
>  	}

Logically looks OK

Acked-by: Marek Vasut <marek.vasut@gmail.com>
Wolfgang Denk - Dec. 1, 2011, 11:11 p.m.
Dear Wolfgang Denk,

In message <1322641077-829-5-git-send-email-wd@denx.de> you wrote:
> Fix:
> flash.c: In function 'flash_erase':
> flash.c:276:24: warning: variable 'l_sect' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> ---
> total: 0 errors, 0 warnings, 49 lines checked
> NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE
> 
>  board/cray/L1/flash.c |   25 +++++++++++--------------
>  1 files changed, 11 insertions(+), 14 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/board/cray/L1/flash.c b/board/cray/L1/flash.c
index a3d893e..77a2100 100644
--- a/board/cray/L1/flash.c
+++ b/board/cray/L1/flash.c
@@ -273,7 +273,7 @@  int	flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *)(info->start[0]);
 	volatile FLASH_WORD_SIZE *addr2;
-	int flag, prot, sect, l_sect;
+	int flag, prot, sect;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -303,16 +303,14 @@  int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	l_sect = -1;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts();
 
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect<=s_last; sect++) {
 		if (info->protect[sect] == 0) {	/* not protected */
-		    addr2 = (FLASH_WORD_SIZE *)(info->start[sect]);
-		    printf("Erasing sector %p\n", addr2);
+			addr2 = (FLASH_WORD_SIZE *)(info->start[sect]);
+			printf("Erasing sector %p\n", addr2);
 
 			addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
 			addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
@@ -320,15 +318,14 @@  int	flash_erase (flash_info_t *info, int s_first, int s_last)
 			addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
 			addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
 			addr2[0] = (FLASH_WORD_SIZE)0x00300030;  /* sector erase */
-		    l_sect = sect;
-		    /*
-		     * Wait for each sector to complete, it's more
-		     * reliable.  According to AMD Spec, you must
-		     * issue all erase commands within a specified
-		     * timeout.  This has been seen to fail, especially
-		     * if printf()s are included (for debug)!!
-		     */
-		    wait_for_DQ7(info, sect);
+			/*
+			 * Wait for each sector to complete, it's more
+			 * reliable.  According to AMD Spec, you must
+			 * issue all erase commands within a specified
+			 * timeout.  This has been seen to fail, especially
+			 * if printf()s are included (for debug)!!
+			 */
+			wait_for_DQ7(info, sect);
 		}
 	}