Patchwork [U-Boot,9/9] ARM: xm250: Fix GCC 4.6 warnings

login
register
mail settings
Submitter Anatolij Gustschin
Date Nov. 19, 2011, 11:59 a.m.
Message ID <1321703956-4224-10-git-send-email-agust@denx.de>
Download mbox | patch
Permalink /patch/126548/
State Not Applicable
Headers show

Comments

Anatolij Gustschin - Nov. 19, 2011, 11:59 a.m.
Fix:
flash.c: In function 'flash_erase':
flash.c:252:6: warning: variable 'flag' set but not used
[-Wunused-but-set-variable]
flash.c: In function 'write_data':
flash.c:421:6: warning: variable 'flag' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 board/xm250/flash.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
Simon Glass - Nov. 19, 2011, 6:05 p.m.
On Sat, Nov 19, 2011 at 3:59 AM, Anatolij Gustschin <agust@denx.de> wrote:
> Fix:
> flash.c: In function 'flash_erase':
> flash.c:252:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'write_data':
> flash.c:421:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>

I don't actually see this warning with my compiler, but it looks right.

Acked-by: Simon Glass <sjg@chromium.org>

> ---
>  board/xm250/flash.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/board/xm250/flash.c b/board/xm250/flash.c
> index e825aba..b953502 100644
> --- a/board/xm250/flash.c
> +++ b/board/xm250/flash.c
> @@ -249,7 +249,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
>
>  int flash_erase (flash_info_t *info, int s_first, int s_last)
>  {
> -       int flag, prot, sect;
> +       int prot, sect;
>        ulong type, start;
>        int rcode = 0;
>
> @@ -284,7 +284,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
>        }
>
>        /* Disable interrupts which might cause a timeout here */
> -       flag = disable_interrupts ();
> +       disable_interrupts();
>
>        /* Start erase on unprotected sectors */
>        for (sect = s_first; sect <= s_last; sect++) {
> @@ -418,7 +418,6 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
>  {
>        FPWV *addr = (FPWV *) dest;
>        ulong status;
> -       int flag;
>        ulong start;
>
>        /* Check if Flash is (sufficiently) erased */
> @@ -427,7 +426,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
>                return (2);
>        }
>        /* Disable interrupts which might cause a timeout here */
> -       flag = disable_interrupts ();
> +       disable_interrupts();
>
>        *addr = (FPW) 0x00400040;       /* write setup */
>        *addr = data;
> --
> 1.7.5.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Marek Vasut - Nov. 21, 2011, 10:39 p.m.
> Fix:
> flash.c: In function 'flash_erase':
> flash.c:252:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'write_data':
> flash.c:421:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  board/xm250/flash.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/board/xm250/flash.c b/board/xm250/flash.c
> index e825aba..b953502 100644
> --- a/board/xm250/flash.c
> +++ b/board/xm250/flash.c
> @@ -249,7 +249,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t
> *info)
> 
>  int flash_erase (flash_info_t *info, int s_first, int s_last)
>  {
> -	int flag, prot, sect;
> +	int prot, sect;
>  	ulong type, start;
>  	int rcode = 0;
> 
> @@ -284,7 +284,7 @@ int flash_erase (flash_info_t *info, int s_first, int
> s_last) }
> 
>  	/* Disable interrupts which might cause a timeout here */
> -	flag = disable_interrupts ();
> +	disable_interrupts();
> 
>  	/* Start erase on unprotected sectors */
>  	for (sect = s_first; sect <= s_last; sect++) {
> @@ -418,7 +418,6 @@ static int write_data (flash_info_t *info, ulong dest,
> FPW data) {
>  	FPWV *addr = (FPWV *) dest;
>  	ulong status;
> -	int flag;
>  	ulong start;
> 
>  	/* Check if Flash is (sufficiently) erased */
> @@ -427,7 +426,7 @@ static int write_data (flash_info_t *info, ulong dest,
> FPW data) return (2);
>  	}
>  	/* Disable interrupts which might cause a timeout here */
> -	flag = disable_interrupts ();
> +	disable_interrupts();
> 
>  	*addr = (FPW) 0x00400040;	/* write setup */
>  	*addr = data;

This one might as well be removed too ? No maintainer in MAINTAINERS so I guess 
it can.

Patch

diff --git a/board/xm250/flash.c b/board/xm250/flash.c
index e825aba..b953502 100644
--- a/board/xm250/flash.c
+++ b/board/xm250/flash.c
@@ -249,7 +249,7 @@  static ulong flash_get_size (FPW *addr, flash_info_t *info)
 
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
-	int flag, prot, sect;
+	int prot, sect;
 	ulong type, start;
 	int rcode = 0;
 
@@ -284,7 +284,7 @@  int flash_erase (flash_info_t *info, int s_first, int s_last)
 	}
 
 	/* Disable interrupts which might cause a timeout here */
-	flag = disable_interrupts ();
+	disable_interrupts();
 
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last; sect++) {
@@ -418,7 +418,6 @@  static int write_data (flash_info_t *info, ulong dest, FPW data)
 {
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
-	int flag;
 	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
@@ -427,7 +426,7 @@  static int write_data (flash_info_t *info, ulong dest, FPW data)
 		return (2);
 	}
 	/* Disable interrupts which might cause a timeout here */
-	flag = disable_interrupts ();
+	disable_interrupts();
 
 	*addr = (FPW) 0x00400040;	/* write setup */
 	*addr = data;