diff mbox

[U-Boot,10/13] board/ti/omap1610inn/flash.c: Fix GCC 4.6 build warnings

Message ID 1323429272-26801-11-git-send-email-wd@denx.de
State Accepted
Headers show

Commit Message

Wolfgang Denk Dec. 9, 2011, 11:14 a.m. UTC
Fix:
flash.c: In function 'flash_get_offsets':
flash.c:139:10: warning: variable 'pOrgDef' set but not used
[-Wunused-but-set-variable]
flash.c: In function 'flash_erase':
flash.c:280:6: warning: variable 'flag' set but not used
[-Wunused-but-set-variable]
flash.c: In function 'write_data':
flash.c:456:6: warning: variable 'flag' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 board/ti/omap1610inn/flash.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

Comments

Tom Rini Dec. 9, 2011, 2:57 p.m. UTC | #1
On Fri, Dec 9, 2011 at 4:14 AM, Wolfgang Denk <wd@denx.de> wrote:
> Fix:
> flash.c: In function 'flash_get_offsets':
> flash.c:139:10: warning: variable 'pOrgDef' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'flash_erase':
> flash.c:280:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'write_data':
> flash.c:456:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
>
> Signed-off-by: Wolfgang Denk <wd@denx.de>

Acked-by: Tom Rini <trini@ti.com>

> ---
>  board/ti/omap1610inn/flash.c |   21 +++++++++++++--------
>  1 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/board/ti/omap1610inn/flash.c b/board/ti/omap1610inn/flash.c
> index 1b67d08..a99a91c 100644
> --- a/board/ti/omap1610inn/flash.c
> +++ b/board/ti/omap1610inn/flash.c
> @@ -136,9 +136,7 @@ void flash_unlock(flash_info_t * info)
>  static void flash_get_offsets (ulong base, flash_info_t * info)
>  {
>        int i;
> -       OrgDef *pOrgDef;
>
> -       pOrgDef = OrgIntel_28F256L18T;
>        if (info->flash_id == FLASH_UNKNOWN) {
>                return;
>        }
> @@ -352,6 +350,9 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
>                        printf (" done\n");
>                }
>        }
> +       if (flag)
> +               enable_interrupts();
> +
>        return rcode;
>  }
>
> @@ -453,13 +454,13 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
>  {
>        FPWV *addr = (FPWV *) dest;
>        ulong status;
> -       int flag;
> +       int flag, rc = 0;
>        ulong start;
>
>        /* Check if Flash is (sufficiently) erased */
>        if ((*addr & data) != data) {
> -               printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
> -               return (2);
> +               printf("not erased at %08lx (%x)\n", (ulong) addr, *addr);
> +               return 2;
>        }
>        /* Disable interrupts which might cause a timeout here */
>        flag = disable_interrupts ();
> @@ -472,12 +473,16 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
>        /* wait while polling the status register */
>        while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
>                if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
> -                       *addr = (FPW) 0x00FF00FF;       /* restore read mode */
> -                       return (1);
> +                       rc = 1;
> +                       goto done;
>                }
>        }
> +done:
> +       if (flag)
> +               enable_interrupts();
> +
>        *addr = (FPW) 0x00FF00FF;       /* restore read mode */
> -       return (0);
> +       return rc;
>  }
>
>  void inline spin_wheel (void)
> --
> 1.7.6.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Wolfgang Denk Dec. 10, 2011, 10:11 p.m. UTC | #2
Dear Wolfgang Denk,

In message <1323429272-26801-11-git-send-email-wd@denx.de> you wrote:
> Fix:
> flash.c: In function 'flash_get_offsets':
> flash.c:139:10: warning: variable 'pOrgDef' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'flash_erase':
> flash.c:280:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'write_data':
> flash.c:456:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> ---
>  board/ti/omap1610inn/flash.c |   21 +++++++++++++--------
>  1 files changed, 13 insertions(+), 8 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/board/ti/omap1610inn/flash.c b/board/ti/omap1610inn/flash.c
index 1b67d08..a99a91c 100644
--- a/board/ti/omap1610inn/flash.c
+++ b/board/ti/omap1610inn/flash.c
@@ -136,9 +136,7 @@  void flash_unlock(flash_info_t * info)
 static void flash_get_offsets (ulong base, flash_info_t * info)
 {
 	int i;
-	OrgDef *pOrgDef;
 
-	pOrgDef = OrgIntel_28F256L18T;
 	if (info->flash_id == FLASH_UNKNOWN) {
 		return;
 	}
@@ -352,6 +350,9 @@  int flash_erase (flash_info_t * info, int s_first, int s_last)
 			printf (" done\n");
 		}
 	}
+	if (flag)
+		enable_interrupts();
+
 	return rcode;
 }
 
@@ -453,13 +454,13 @@  static int write_data (flash_info_t * info, ulong dest, FPW data)
 {
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
-	int flag;
+	int flag, rc = 0;
 	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
-		printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
-		return (2);
+		printf("not erased at %08lx (%x)\n", (ulong) addr, *addr);
+		return 2;
 	}
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
@@ -472,12 +473,16 @@  static int write_data (flash_info_t * info, ulong dest, FPW data)
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
 		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
-			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
-			return (1);
+			rc = 1;
+			goto done;
 		}
 	}
+done:
+	if (flag)
+		enable_interrupts();
+
 	*addr = (FPW) 0x00FF00FF;	/* restore read mode */
-	return (0);
+	return rc;
 }
 
 void inline spin_wheel (void)