Skip to contentSkip to conversation

common/menu.c: Fix build warning

PATCH New Anatolij Gustschin 8 participants 38 messages Dec 3, 2011 – Dec 9, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/9 common/menu.c: Fix build warning

Fix:
menu.c: In function 'menu_item_print':
menu.c:91: warning: passing argument 1 of 'putc' makes integer from pointer without a cast

---
 common/menu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/menu.c +1 -1
index ca1baef..5e0817c 100644
@@ -88,7 +88,7 @@ static inline void *menu_item_print(struct menu *m,
 				void *extra)
 {
 	if (!m->item_data_print) {
-		putc(item->key);
+		puts(item->key);
 		putc('\n');
 	} else {
 		m->item_data_print(item->data);
Signature · 1 line
1.7.6.4
#1 lore raw

PATCH 2/9 drivers/mtd/nand/nand_spl_simple.c: Fix GCC 4.6 warnings

Fix warnings for both cases:

definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:156:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

not definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:196:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_simple.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/nand/nand_spl_simple.c +2 -4
index ed821f2..7eb08a3 100644
@@ -153,7 +153,6 @@ static int nand_read_page(int block, int page, uchar *dst)
 	int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
 	int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
 	uint8_t *p = dst;
-	int stat;
 
 	/*
 	 * No malloc available for now, just use some temporary locations
@@ -176,7 +175,7 @@ static int nand_read_page(int block, int page, uchar *dst)
 		this->ecc.hwctl(&mtd, NAND_ECC_READ);
 		this->read_buf(&mtd, p, eccsize);
 		this->ecc.calculate(&mtd, p, &ecc_calc[i]);
-		stat = this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
+		this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
 	}
 
 	return 0;
@@ -193,7 +192,6 @@ static int nand_read_page(int block, int page, void *dst)
 	int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
 	int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
 	uint8_t *p = dst;
-	int stat;
 
 	nand_command(block, page, 0, NAND_CMD_READ0);
 
@@ -224,7 +222,7 @@ static int nand_read_page(int block, int page, void *dst)
 		 * from correct_data(). We just hope that all possible errors
 		 * are corrected by this routine.
 		 */
-		stat = this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
+		this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
 	}
 
 	return 0;
Signature · 1 line
1.7.6.4
#2 lore raw

PATCH 2/9 drivers/mtd/nand/nand_spl_simple.c: Fix GCC 4.6 warnings

Hello Anatolij,

Quoted 12 lines · Anatolij Gustschin

Fix warnings for both cases:

definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:156:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

not definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:196:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

Quoted 6 lines
Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_simple.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH 2/9 drivers/mtd/nand/nand_spl_simple.c: Fix GCC 4.6 warnings

In reply to Anatolij Gustschin
Quoted 49 lines

Fix warnings for both cases:

definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:156:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

not definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:196:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_simple.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/mtd/nand/nand_spl_simple.c index ed821f2..7eb08a3 100644

drivers/mtd/nand/nand_spl_simple.c +1 -3
@@ -153,7 +153,6 @@ static int nand_read_page(int block, int page, uchar
 *dst) int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
 	int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
 	uint8_t *p = dst;
-	int stat;
 
 	/*
 	 * No malloc available for now, just use some temporary locations
@@ -176,7 +175,7 @@ static int nand_read_page(int block, int page, uchar
 *dst) this->ecc.hwctl(&mtd, NAND_ECC_READ);
 		this->read_buf(&mtd, p, eccsize);
 		this->ecc.calculate(&mtd, p, &ecc_calc[i]);
-		stat = this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
+		this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
 	}
 
 	return 0;
@@ -193,7 +192,6 @@ static int nand_read_page(int block, int page, void
 *dst) int eccbytes = CONFIG_SYS_NAND_ECCBYTES;
 	int eccsteps = CONFIG_SYS_NAND_ECCSTEPS;
 	uint8_t *p = dst;
-	int stat;
 
 	nand_command(block, page, 0, NAND_CMD_READ0);
 

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void · line 228

Quoted 8 lines
drivers/mtd/nand/nand_spl_simple.c +1 -1
@@ -224,7 +222,7 @@ static int nand_read_page(int block, int page, void
 *dst) * from correct_data(). We just hope that all possible errors
 		 * are corrected by this routine.
 		 */
-		stat = this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
+		this->ecc.correct(&mtd, p, &ecc_code[i], &ecc_calc[i]);
 	}
 
 	return 0;
#4 lore raw

PATCH 2/9 drivers/mtd/nand/nand_spl_simple.c: Fix GCC 4.6 warnings

In reply to Anatolij Gustschin
Quoted 12 lines · Anatolij Gustschin

Fix warnings for both cases:

definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:156:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

not definded CONFIG_SYS_NAND_HW_ECC_OOBFIRST:
nand_spl_simple.c: In function 'nand_read_page':
nand_spl_simple.c:196:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]

Quoted 6 lines
Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_simple.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Applied to u-boot-nand-flash

-Scott

#5 lore raw

PATCH 3/9 drivers/mtd/nand/nand_spl_load.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin

Fix:
nand_spl_load.c: In function 'nand_boot':
nand_spl_load.c:31:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_load.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
drivers/mtd/nand/nand_spl_load.c +6 -7
index ae8d5ac..215459a 100644
@@ -28,23 +28,22 @@
  */
 void nand_boot(void)
 {
-	int ret;
 	__attribute__((noreturn)) void (*uboot)(void);
 
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	ret =  nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
 			CONFIG_SYS_NAND_U_BOOT_SIZE,
-		(void *)CONFIG_SYS_NAND_U_BOOT_DST);
+			(void *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	ret =  nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		(void *)CONFIG_NAND_ENV_DST);
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			(void *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	ret =  nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		(void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			(void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
 
Signature · 1 line
1.7.6.4
#6 lore raw

PATCH 3/9 drivers/mtd/nand/nand_spl_load.c: Fix GCC 4.6 warning

Hello Anatolij,

Quoted 11 lines · Anatolij Gustschin

Fix:
nand_spl_load.c: In function 'nand_boot':
nand_spl_load.c:31:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_load.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

Thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#7 lore raw

PATCH 3/9 drivers/mtd/nand/nand_spl_load.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin
Quoted 35 lines

Fix:
nand_spl_load.c: In function 'nand_boot':
nand_spl_load.c:31:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_load.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/mtd/nand/nand_spl_load.c index ae8d5ac..215459a 100644

drivers/mtd/nand/nand_spl_load.c +2 -5
@@ -28,23 +28,22 @@
  */
 void nand_boot(void)
 {
-	int ret;
 	__attribute__((noreturn)) void (*uboot)(void);
 
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	ret =  nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
 			CONFIG_SYS_NAND_U_BOOT_SIZE,
-		(void *)CONFIG_SYS_NAND_U_BOOT_DST);
+			(void *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	ret =  nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		(void *)CONFIG_NAND_ENV_DST);

drivers/mtd/nand/nand_spl_load.c line 48

Quoted 10 lines
drivers/mtd/nand/nand_spl_load.c +4 -2
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			(void *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	ret =  nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		(void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			(void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
#8 lore raw

PATCH 3/9 drivers/mtd/nand/nand_spl_load.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin
Quoted 11 lines · Anatolij Gustschin

Fix:
nand_spl_load.c: In function 'nand_boot':
nand_spl_load.c:31:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Cc Heiko Schocher <[email protected]>
Cc Scott Wood <[email protected]>
---
 drivers/mtd/nand/nand_spl_load.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

Applied to u-boot-nand-flash

-Scott

#9 lore raw

PATCH 4/9 drivers/usb/musb/musb_udc.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin

Fix:
musb_udc.c: In function 'musb_peri_softconnect':
musb_udc.c:166:14: warning: variable 'intrtx' set but not used [-Wunused-but-set-variable]
musb_udc.c:166:6: warning: variable 'intrrx' set but not used [-Wunused-but-set-variable]
musb_udc.c:165:5: warning: variable 'intrusb' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/musb/musb_udc.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/musb/musb_udc.c +3 -5
index 6f6ed61..09cdec3 100644
@@ -162,8 +162,6 @@ static void musb_db_regs(void)
 static void musb_peri_softconnect(void)
 {
 	u8 power, devctl;
-	u8 intrusb;
-	u16 intrrx, intrtx;
 
 	/* Power off MUSB */
 	power = readb(&musbr->power);
@@ -171,9 +169,9 @@ static void musb_peri_softconnect(void)
 	writeb(power, &musbr->power);
 
 	/* Read intr to clear */
-	intrusb = readb(&musbr->intrusb);
-	intrrx = readw(&musbr->intrrx);
-	intrtx = readw(&musbr->intrtx);
+	readb(&musbr->intrusb);
+	readw(&musbr->intrrx);
+	readw(&musbr->intrtx);
 
 	udelay(1000 * 1000); /* 1 sec */
 
Signature · 1 line
1.7.6.4
#10 lore raw

PATCH 4/9 drivers/usb/musb/musb_udc.c: Fix GCC 4.6 warning

Hi,

2011/12/3 Anatolij Gustschin <[email protected]>:

Quoted 39 lines

Fix:
musb_udc.c: In function 'musb_peri_softconnect':
musb_udc.c:166:14: warning: variable 'intrtx' set but not used [-Wunused-but-set-variable]
musb_udc.c:166:6: warning: variable 'intrrx' set but not used [-Wunused-but-set-variable]
musb_udc.c:165:5: warning: variable 'intrusb' set but not used [-Wunused-but-set-variable]

---
?drivers/usb/musb/musb_udc.c | ? ?8 +++-----
?1 files changed, 3 insertions(+), 5 deletions(-)

drivers/usb/musb/musb_udc.c +0 -2
index 6f6ed61..09cdec3 100644
@@ -162,8 +162,6 @@ static void musb_db_regs(void)
 ?static void musb_peri_softconnect(void)
 ?{
 ? ? ? ?u8 power, devctl;
- ? ? ? u8 intrusb;
- ? ? ? u16 intrrx, intrtx;
 

? ? ? ?/* Power off MUSB */
? ? ? ?power = readb(&musbr->power);

drivers/usb/musb/musb_udc.c +0 -0
@@ -171,9 +169,9 @@ static void musb_peri_softconnect(void)
 ? ? ? ?writeb(power, &musbr->power);
 

? ? ? ?/* Read intr to clear */
- ? ? ? intrusb = readb(&musbr->intrusb);
- ? ? ? intrrx = readw(&musbr->intrrx);
- ? ? ? intrtx = readw(&musbr->intrtx);
+ ? ? ? readb(&musbr->intrusb);
+ ? ? ? readw(&musbr->intrrx);
+ ? ? ? readw(&musbr->intrtx);

Quoted 1 line

? ? ? ?udelay(1000 * 1000); /* 1 sec */

Since it is part of a series with non-USB related changes:

Kind regards,

Remy

#11 lore raw

PATCH 4/9 drivers/usb/musb/musb_udc.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin
Quoted 30 lines

Fix:
musb_udc.c: In function 'musb_peri_softconnect':
musb_udc.c:166:14: warning: variable 'intrtx' set but not used [-Wunused-but-set-variable]
musb_udc.c:166:6: warning: variable 'intrrx' set but not used [-Wunused-but-set-variable]
musb_udc.c:165:5: warning: variable 'intrusb' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/musb/musb_udc.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/musb/musb_udc.c +0 -2
index 6f6ed61..09cdec3 100644
@@ -162,8 +162,6 @@ static void musb_db_regs(void)
 static void musb_peri_softconnect(void)
 {
 	u8 power, devctl;
-	u8 intrusb;
-	u16 intrrx, intrtx;
 
 	/* Power off MUSB */
 	power = readb(&musbr->power);
@@ -171,9 +169,9 @@ static void musb_peri_softconnect(void)
 	writeb(power, &musbr->power);

drivers/usb/musb/musb_udc.c static void musb_peri_softconnect(void) · line 176

Quoted 10 lines
drivers/usb/musb/musb_udc.c +3 -3
 
 	/* Read intr to clear */
-	intrusb = readb(&musbr->intrusb);
-	intrrx = readw(&musbr->intrrx);
-	intrtx = readw(&musbr->intrtx);
+	readb(&musbr->intrusb);
+	readw(&musbr->intrrx);
+	readw(&musbr->intrtx);
 
 	udelay(1000 * 1000); /* 1 sec */
#12 lore raw

PATCH 4/9 drivers/usb/musb/musb_udc.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin

Dear Anatolij Gustschin,

Quoted 9 lines · In message <[email protected]> you wrote:

Fix:
musb_udc.c: In function 'musb_peri_softconnect':
musb_udc.c:166:14: warning: variable 'intrtx' set but not used [-Wunused-but-set-variable]
musb_udc.c:166:6: warning: variable 'intrrx' set but not used [-Wunused-but-set-variable]
musb_udc.c:165:5: warning: variable 'intrusb' set but not used [-Wunused-but-set-variable]

Quoted 5 lines
---
 drivers/usb/musb/musb_udc.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 9 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Everyone who comes in here wants three things:
        1. They want it quick.
        2. They want it good.
        3. They want it cheap.
I tell 'em to pick two and call me back.
- sign on the back wall of a small printing company in Delaware
#13 lore raw

PATCH 5/9 drivers/usb/gadget/core.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin

Fix:
core.c: In function 'usbd_device_event_irq':
core.c:596:21: warning: variable 'state' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/gadget/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/core.c +2 -2
index 67b6681..4f2ebab 100644
@@ -671,9 +671,9 @@ void usbd_device_event_irq (struct usb_device_instance *device, usb_device_event
 		usbdbg("event %d - not handled",event);
 		break;
 	}
-	/*usbdbg("%s event: %d oldstate: %d newstate: %d status: %d address: %d",
+	debug("%s event: %d oldstate: %d newstate: %d status: %d address: %d",
 		device->name, event, state,
-		device->device_state, device->status, device->address); */
+		device->device_state, device->status, device->address);
 
 	/* tell the bus interface driver */
 	if( device->event ) {
Signature · 1 line
1.7.6.4
#14 lore raw

PATCH 5/9 drivers/usb/gadget/core.c: Fix GCC 4.6 warning

Hi,

2011/12/3 Anatolij Gustschin <[email protected]>:

Quoted 10 lines

Fix:
core.c: In function 'usbd_device_event_irq':
core.c:596:21: warning: variable 'state' set but not used [-Wunused-but-set-variable]

---
?drivers/usb/gadget/core.c | ? ?4 ++--
?1 files changed, 2 insertions(+), 2 deletions(-)

Since it is part of a series with non-USB related changes:

Kind regards,

Remy

#15 lore raw

PATCH 5/9 drivers/usb/gadget/core.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin
Quoted 16 lines

Fix:
core.c: In function 'usbd_device_event_irq':
core.c:596:21: warning: variable 'state' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/gadget/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/core.c +0 -0
index 67b6681..4f2ebab 100644

drivers/usb/gadget/core.c void usbd_device_event_irq (struct usb_device_instance · line 674

Quoted 4 lines
drivers/usb/gadget/core.c +0 -1
@@ -671,9 +671,9 @@ void usbd_device_event_irq (struct usb_device_instance
 *device, usb_device_event usbdbg("event %d - not handled",event);
 		break;
 	}
-	/*usbdbg("%s event: %d oldstate: %d newstate: %d status: %d address: 

%d",

drivers/usb/gadget/core.c void usbd_device_event_irq (struct usb_device_instance *device, usb_device_event · line 679

Quoted 7 lines
drivers/usb/gadget/core.c +2 -1
+	debug("%s event: %d oldstate: %d newstate: %d status: %d address: %d",
 		device->name, event, state,
-		device->device_state, device->status, device->address); */
+		device->device_state, device->status, device->address);
 
 	/* tell the bus interface driver */
 	if( device->event ) {
#16 lore raw

PATCH 5/9 drivers/usb/gadget/core.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin

Dear Anatolij Gustschin,

Quoted 10 lines · In message <[email protected]> you wrote:

Fix:
core.c: In function 'usbd_device_event_irq':
core.c:596:21: warning: variable 'state' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/gadget/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A girl with a future avoids the man with a past.
                                   -- Evan Esar, "The Humor of Humor"
#17 lore raw

PATCH 6/9 drivers/usb/gadget/ep0.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin

Fix:
ep0.c: In function 'ep0_get_descriptor':
ep0.c:187:8: warning: variable 'cp' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/gadget/ep0.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/usb/gadget/ep0.c +0 -2
index 2b4ec44..22499d3 100644
@@ -184,7 +184,6 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
 			       int index)
 {
 	int port = 0;		/* XXX compound device */
-	char *cp;
 
 	/*dbg_ep0(3, "max: %x type: %x index: %x", max, descriptor_type, index); */
 
@@ -196,7 +195,6 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
 
 	/* setup tx urb */
 	urb->actual_length = 0;
-	cp = (char*)urb->buffer;
 
 	dbg_ep0 (2, "%s", USBD_DEVICE_DESCRIPTORS (descriptor_type));
 
Signature · 1 line
1.7.6.4
#18 lore raw

PATCH 6/9 drivers/usb/gadget/ep0.c: Fix GCC 4.6 warning

Hi,

2011/12/3 Anatolij Gustschin <[email protected]>:

Quoted 29 lines

Fix:
ep0.c: In function 'ep0_get_descriptor':
ep0.c:187:8: warning: variable 'cp' set but not used [-Wunused-but-set-variable]

---
?drivers/usb/gadget/ep0.c | ? ?2 --
?1 files changed, 0 insertions(+), 2 deletions(-)

drivers/usb/gadget/ep0.c +0 -0
index 2b4ec44..22499d3 100644
@@ -184,7 +184,6 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int index)
 ?{

? ? ? ?int port = 0; ? ? ? ? ? /* XXX compound device */
- ? ? ? char *cp;

? ? ? ?/*dbg_ep0(3, "max: %x type: %x index: %x", max, descriptor_type, index); */

drivers/usb/gadget/ep0.c +0 -0
@@ -196,7 +195,6 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
 

? ? ? ?/* setup tx urb */
? ? ? ?urb->actual_length = 0;
- ? ? ? cp = (char*)urb->buffer;

Quoted 1 line

? ? ? ?dbg_ep0 (2, "%s", USBD_DEVICE_DESCRIPTORS (descriptor_type));

Since it is part of a series with non-USB related changes:

Kind regards,

Remy

#19 lore raw

PATCH 6/9 drivers/usb/gadget/ep0.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin
Quoted 25 lines

Fix:
ep0.c: In function 'ep0_get_descriptor':
ep0.c:187:8: warning: variable 'cp' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/gadget/ep0.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/usb/gadget/ep0.c +0 -1
index 2b4ec44..22499d3 100644
@@ -184,7 +184,6 @@ static int ep0_get_descriptor (struct
 usb_device_instance *device, int index)
 {
 	int port = 0;		/* XXX compound device */
-	char *cp;
 
 	/*dbg_ep0(3, "max: %x type: %x index: %x", max, descriptor_type, index);
 */

drivers/usb/gadget/ep0.c static int ep0_get_descriptor (struct · line 200

Quoted 7 lines
drivers/usb/gadget/ep0.c +0 -1
@@ -196,7 +195,6 @@ static int ep0_get_descriptor (struct
 usb_device_instance *device,
 
 	/* setup tx urb */
 	urb->actual_length = 0;
-	cp = (char*)urb->buffer;
 
 	dbg_ep0 (2, "%s", USBD_DEVICE_DESCRIPTORS (descriptor_type));
#20 lore raw

PATCH 6/9 drivers/usb/gadget/ep0.c: Fix GCC 4.6 warning

In reply to Anatolij Gustschin

Dear Anatolij Gustschin,

Quoted 10 lines · In message <[email protected]> you wrote:

Fix:
ep0.c: In function 'ep0_get_descriptor':
ep0.c:187:8: warning: variable 'cp' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/gadget/ep0.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In theory, there is no difference between  theory  and  practice.  In
practice, however, there is.
#21 lore raw

PATCH 7/9 arch/arm/cpu/armv7/omap-common/spl.c: Fix GCC 4.2 warnings

In reply to Anatolij Gustschin

Fix:
spl.c: In function 'jump_to_image_no_args':
spl.c:103: warning: assignment makes pointer from integer without a cast spl.c:105: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 arch/arm/cpu/armv7/omap-common/spl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +3 -2
index 25f04ed..9c35a09 100644
@@ -100,9 +100,10 @@ static void jump_to_image_no_args(void)
 	debug("image entry point: 0x%X\n", spl_image.entry_point);
 	/* Pass the saved boot_params from rom code */
 #if defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU)
-	image_entry = 0x80100000;
+	image_entry = (image_entry_noargs_t)0x80100000;
 #endif
-	image_entry((u32 *)&boot_params_ptr);
+	u32 boot_params_ptr_addr = (u32)&boot_params_ptr;
+	image_entry((u32 *)boot_params_ptr_addr);
 }
 
 void jump_to_image_no_args(void) __attribute__ ((noreturn));
Signature · 1 line
1.7.6.4
#22 lore raw

PATCH 7/9 arch/arm/cpu/armv7/omap-common/spl.c: Fix GCC 4.2 warnings

Quoted 20 lines

Fix:
spl.c: In function 'jump_to_image_no_args':
spl.c:103: warning: assignment makes pointer from integer without a cast spl.c:105: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 arch/arm/cpu/armv7/omap-common/spl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/omap-common/spl.c index 25f04ed..9c35a09 100644

arch/arm/cpu/armv7/omap-common/spl.c +0 -0
@@ -100,9 +100,10 @@ static void jump_to_image_no_args(void)
 	debug("image entry point: 0x%X\n", spl_image.entry_point);
 	/* Pass the saved boot_params from rom code */

arch/arm/cpu/armv7/omap-common/spl.c static void jump_to_image_no_args(void) · line 109

Quoted 10 lines
arch/arm/cpu/armv7/omap-common/spl.c +3 -2
 #if defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU)
-	image_entry = 0x80100000;
+	image_entry = (image_entry_noargs_t)0x80100000;
 #endif
-	image_entry((u32 *)&boot_params_ptr);
+	u32 boot_params_ptr_addr = (u32)&boot_params_ptr;
+	image_entry((u32 *)boot_params_ptr_addr);
 }
 
 void jump_to_image_no_args(void) __attribute__ ((noreturn));
#23 lore raw

PATCH 7/9 arch/arm/cpu/armv7/omap-common/spl.c: Fix GCC 4.2 warnings

Quoted 29 lines · Marek Vasut
Quoted 29 lines

Fix:
spl.c: In function 'jump_to_image_no_args':
spl.c:103: warning: assignment makes pointer from integer without a cast spl.c:105: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 arch/arm/cpu/armv7/omap-common/spl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/omap-common/spl.c index 25f04ed..9c35a09 100644

arch/arm/cpu/armv7/omap-common/spl.c +3 -2
@@ -100,9 +100,10 @@ static void jump_to_image_no_args(void)
 	debug("image entry point: 0x%X\n", spl_image.entry_point);
 	/* Pass the saved boot_params from rom code */
 #if defined(CONFIG_VIRTIO) || defined(CONFIG_ZEBU)
-	image_entry = 0x80100000;
+	image_entry = (image_entry_noargs_t)0x80100000;
 #endif
-	image_entry((u32 *)&boot_params_ptr);
+	u32 boot_params_ptr_addr = (u32)&boot_params_ptr;
+	image_entry((u32 *)boot_params_ptr_addr);
 }
 
Quoted 3 lines

arch/arm/cpu/armv7/omap-common/spl.c static void jump_to_image_no_args(void) · line 109

Quoted 1 line
arch/arm/cpu/armv7/omap-common/spl.c +0 -0
 void jump_to_image_no_args(void) __attribute__ ((noreturn));

And will be queued to u-boot-ti/master once the current pull request is dealt with.

Signature · 1 line
Tom
#24 lore raw

PATCH 8/9 arch/arm/cpu/armv7/omap-common/clocks-common.c: Fix GCC 4.6 warnings

In reply to Anatolij Gustschin

Fix:
clocks-common.c: In function 'setup_dplls':
clocks-common.c:256:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]
clocks-common.c: In function 'setup_non_essential_dplls':
clocks-common.c:292:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]

---
 arch/arm/cpu/armv7/omap-common/clocks-common.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/cpu/armv7/omap-common/clocks-common.c +3 -5
index 1e7e20e..1da90a4 100644
@@ -253,11 +253,10 @@ void configure_mpu_dpll(void)
 
 static void setup_dplls(void)
 {
-	u32 sysclk_ind, temp;
+	u32 temp;
 	const struct dpll_params *params;
-	debug("setup_dplls\n");
 
-	sysclk_ind = get_sys_clk_index();
+	debug("setup_dplls\n");
 
 	/* CORE dpll */
 	params = get_core_dpll_params();	/* default - safest */
@@ -289,10 +288,9 @@ static void setup_dplls(void)
 static void setup_non_essential_dplls(void)
 {
 	u32 sys_clk_khz, abe_ref_clk;
-	u32 sysclk_ind, sd_div, num, den;
+	u32 sd_div, num, den;
 	const struct dpll_params *params;
 
-	sysclk_ind = get_sys_clk_index();
 	sys_clk_khz = get_sys_clk_freq() / 1000;
 
 	/* IVA */
Signature · 1 line
1.7.6.4
#25 lore raw

PATCH 8/9 arch/arm/cpu/armv7/omap-common/clocks-common.c: Fix GCC 4.6 warnings

Quoted 36 lines

Fix:
clocks-common.c: In function 'setup_dplls':
clocks-common.c:256:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]
clocks-common.c: In function 'setup_non_essential_dplls':
clocks-common.c:292:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]

---
 arch/arm/cpu/armv7/omap-common/clocks-common.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/omap-common/clocks-common.c index 1e7e20e..1da90a4 100644

arch/arm/cpu/armv7/omap-common/clocks-common.c +2 -3
@@ -253,11 +253,10 @@ void configure_mpu_dpll(void)
 
 static void setup_dplls(void)
 {
-	u32 sysclk_ind, temp;
+	u32 temp;
 	const struct dpll_params *params;
-	debug("setup_dplls\n");
 
-	sysclk_ind = get_sys_clk_index();
+	debug("setup_dplls\n");
 
 	/* CORE dpll */
 	params = get_core_dpll_params();	/* default - safest */
@@ -289,10 +288,9 @@ static void setup_dplls(void)
 static void setup_non_essential_dplls(void)

arch/arm/cpu/armv7/omap-common/clocks-common.c static void setup_dplls(void) · line 296

Quoted 10 lines
arch/arm/cpu/armv7/omap-common/clocks-common.c +1 -2
 {
 	u32 sys_clk_khz, abe_ref_clk;
-	u32 sysclk_ind, sd_div, num, den;
+	u32 sd_div, num, den;
 	const struct dpll_params *params;
 
-	sysclk_ind = get_sys_clk_index();
 	sys_clk_khz = get_sys_clk_freq() / 1000;
 
 	/* IVA */
#26 lore raw

PATCH 8/9 arch/arm/cpu/armv7/omap-common/clocks-common.c: Fix GCC 4.6 warnings

In reply to Anatolij Gustschin
Quoted 23 lines · Anatolij Gustschin

Fix:
clocks-common.c: In function 'setup_dplls':
clocks-common.c:256:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]
clocks-common.c: In function 'setup_non_essential_dplls':
clocks-common.c:292:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]

---
 arch/arm/cpu/armv7/omap-common/clocks-common.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/cpu/armv7/omap-common/clocks-common.c +0 -0
index 1e7e20e..1da90a4 100644
@@ -253,11 +253,10 @@ void configure_mpu_dpll(void)
 
 static void setup_dplls(void)
 {

arch/arm/cpu/armv7/omap-common/clocks-common.c void configure_mpu_dpll(void) · line 262

Quoted 10 lines
arch/arm/cpu/armv7/omap-common/clocks-common.c +2 -3
-	u32 sysclk_ind, temp;
+	u32 temp;
 	const struct dpll_params *params;
-	debug("setup_dplls\n");
 
-	sysclk_ind = get_sys_clk_index();
+	debug("setup_dplls\n");
 
 	/* CORE dpll */
 	params = get_core_dpll_params();	/* default - safest */

Hand-editing the diffs? Not sure why the debug print looks like it moved. But regardless...

And will be queued to u-boot-ti/master once Albert pulls /comments on my current request.

Signature · 1 line
Tom
#27 lore raw

PATCH 8/9 arch/arm/cpu/armv7/omap-common/clocks-common.c: Fix GCC 4.6 warnings

Quoted 29 lines · On Mon, 5 Dec 2011 08:02:53 -0700 Tom Rini <[email protected]> wrote:
Quoted 28 lines · Anatolij Gustschin

Fix:
clocks-common.c: In function 'setup_dplls':
clocks-common.c:256:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]
clocks-common.c: In function 'setup_non_essential_dplls':
clocks-common.c:292:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]

---
 arch/arm/cpu/armv7/omap-common/clocks-common.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/cpu/armv7/omap-common/clocks-common.c +1 -2
index 1e7e20e..1da90a4 100644
@@ -253,11 +253,10 @@ void configure_mpu_dpll(void)
 
 static void setup_dplls(void)
 {
-	u32 sysclk_ind, temp;
+	u32 temp;
 	const struct dpll_params *params;
-	debug("setup_dplls\n");
 
Quoted 8 lines

arch/arm/cpu/armv7/omap-common/clocks-common.c void configure_mpu_dpll(void) · line 262

Quoted 5 lines
arch/arm/cpu/armv7/omap-common/clocks-common.c +1 -1
-	sysclk_ind = get_sys_clk_index();
+	debug("setup_dplls\n");
 
 	/* CORE dpll */
 	params = get_core_dpll_params();	/* default - safest */

Hand-editing the diffs? Not sure why the debug print looks like it moved. But regardless...

No, not this time. I moved the debug print intentionally to fix the coding style, while at it. It doesn't make sense to send separate patch for this coding style fix. I should have mentioned this in the commit log, sorry.

Thanks for review!

Anatolij

#28 lore raw

PATCH 8/9 arch/arm/cpu/armv7/omap-common/clocks-common.c: Fix GCC 4.6 warnings

Quoted 41 lines · Anatolij Gustschin
Quoted 29 lines · On Mon, 5 Dec 2011 08:02:53 -0700 Tom Rini <[email protected]> wrote:
Quoted 28 lines · Anatolij Gustschin

Fix:
clocks-common.c: In function 'setup_dplls':
clocks-common.c:256:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]
clocks-common.c: In function 'setup_non_essential_dplls':
clocks-common.c:292:6: warning: variable 'sysclk_ind' set but not used [-Wunused-but-set-variable]

---
 arch/arm/cpu/armv7/omap-common/clocks-common.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/cpu/armv7/omap-common/clocks-common.c +1 -2
index 1e7e20e..1da90a4 100644
@@ -253,11 +253,10 @@ void configure_mpu_dpll(void)
 
 static void setup_dplls(void)
 {
-	u32 sysclk_ind, temp;
+	u32 temp;
 	const struct dpll_params *params;
-	debug("setup_dplls\n");
 
Quoted 8 lines

arch/arm/cpu/armv7/omap-common/clocks-common.c void configure_mpu_dpll(void) · line 262

Quoted 5 lines
arch/arm/cpu/armv7/omap-common/clocks-common.c +1 -1
-	sysclk_ind = get_sys_clk_index();
+	debug("setup_dplls\n");
 
 	/* CORE dpll */
 	params = get_core_dpll_params();	/* default - safest */

Hand-editing the diffs? Not sure why the debug print looks like it moved. But regardless...

Quoted 4 lines

No, not this time. I moved the debug print intentionally to fix the coding style, while at it. It doesn't make sense to send separate patch for this coding style fix. I should have mentioned this in the commit log, sorry.

Ah, OK, now I see it, thanks (and will still merge as-is).

Signature · 1 line
Tom
#29 lore raw

PATCH 9/9 arch/arm/include/asm/arch-omap5/clocks.h: Fix GCC 4.2 warnings

In reply to Anatolij Gustschin

Fix:
clocks.c: In function 'setup_post_dividers':
clocks.c:175: warning: comparison is always true due to limited range of data type
clocks.c:177: warning: comparison is always true due to limited range of data type
clocks.c:179: warning: comparison is always true due to limited range of data type
clocks.c:181: warning: comparison is always true due to limited range of data type
clocks.c:183: warning: comparison is always true due to limited range of data type
clocks.c:185: warning: comparison is always true due to limited range of data type
clocks.c:187: warning: comparison is always true due to limited range of data type
clocks.c:189: warning: comparison is always true due to limited range of data type

---
Some notes:

- GCC v4.5.1 didn't warn here
- GCC v4.6.1 seems to have a bug and can't compile this code:
clocks.c: In function 'enable_non_essential_clocks':
clocks.c:349:13: internal compiler error: in decode_addr_const, at varasm.c:2632

 arch/arm/include/asm/arch-omap5/clocks.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/include/asm/arch-omap5/clocks.h +8 -8
index fa99f65..d0e6dd6 100644
@@ -686,14 +686,14 @@ struct dpll_regs {
 struct dpll_params {
 	u32 m;
 	u32 n;
-	u8 m2;
-	u8 m3;
-	u8 h11;
-	u8 h12;
-	u8 h13;
-	u8 h14;
-	u8 h22;
-	u8 h23;
+	s8 m2;
+	s8 m3;
+	s8 h11;
+	s8 h12;
+	s8 h13;
+	s8 h14;
+	s8 h22;
+	s8 h23;
 };
 
 extern struct omap5_prcm_regs *const prcm;
Signature · 1 line
1.7.6.4
#30 lore raw

PATCH 9/9 arch/arm/include/asm/arch-omap5/clocks.h: Fix GCC 4.2 warnings

Quoted 51 lines

Fix:
clocks.c: In function 'setup_post_dividers':
clocks.c:175: warning: comparison is always true due to limited range of data type
clocks.c:177: warning: comparison is always true due to limited range of data type
clocks.c:179: warning: comparison is always true due to limited range of data type
clocks.c:181: warning: comparison is always true due to limited range of data type
clocks.c:183: warning: comparison is always true due to limited range of data type
clocks.c:185: warning: comparison is always true due to limited range of data type
clocks.c:187: warning: comparison is always true due to limited range of data type
clocks.c:189: warning: comparison is always true due to limited range of data type

---
Some notes:

- GCC v4.5.1 didn't warn here
- GCC v4.6.1 seems to have a bug and can't compile this code:
clocks.c: In function 'enable_non_essential_clocks':
clocks.c:349:13: internal compiler error: in decode_addr_const, at
varasm.c:2632

 arch/arm/include/asm/arch-omap5/clocks.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-omap5/clocks.h index fa99f65..d0e6dd6 100644

arch/arm/include/asm/arch-omap5/clocks.h +1 -8
@@ -686,14 +686,14 @@ struct dpll_regs {
 struct dpll_params {
 	u32 m;
 	u32 n;
-	u8 m2;
-	u8 m3;
-	u8 h11;
-	u8 h12;
-	u8 h13;
-	u8 h14;
-	u8 h22;
-	u8 h23;
+	s8 m2;

arch/arm/include/asm/arch-omap5/clocks.h struct dpll_regs { · line 699

Quoted 10 lines
arch/arm/include/asm/arch-omap5/clocks.h +7 -0
+	s8 m3;
+	s8 h11;
+	s8 h12;
+	s8 h13;
+	s8 h14;
+	s8 h22;
+	s8 h23;
 };
 
 extern struct omap5_prcm_regs *const prcm;

Make clock registers a signed type? whoa

#31 lore raw

PATCH 9/9 arch/arm/include/asm/arch-omap5/clocks.h: Fix GCC 4.2 warnings

Quoted 60 lines · On Sun, 4 Dec 2011 12:30:40 +0100 Marek Vasut <[email protected]> wrote:
Quoted 60 lines

Fix:
clocks.c: In function 'setup_post_dividers':
clocks.c:175: warning: comparison is always true due to limited range of data type
clocks.c:177: warning: comparison is always true due to limited range of data type
clocks.c:179: warning: comparison is always true due to limited range of data type
clocks.c:181: warning: comparison is always true due to limited range of data type
clocks.c:183: warning: comparison is always true due to limited range of data type
clocks.c:185: warning: comparison is always true due to limited range of data type
clocks.c:187: warning: comparison is always true due to limited range of data type
clocks.c:189: warning: comparison is always true due to limited range of data type

---
Some notes:

- GCC v4.5.1 didn't warn here
- GCC v4.6.1 seems to have a bug and can't compile this code:
clocks.c: In function 'enable_non_essential_clocks':
clocks.c:349:13: internal compiler error: in decode_addr_const, at
varasm.c:2632

 arch/arm/include/asm/arch-omap5/clocks.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-omap5/clocks.h index fa99f65..d0e6dd6 100644

arch/arm/include/asm/arch-omap5/clocks.h +8 -8
@@ -686,14 +686,14 @@ struct dpll_regs {
 struct dpll_params {
 	u32 m;
 	u32 n;
-	u8 m2;
-	u8 m3;
-	u8 h11;
-	u8 h12;
-	u8 h13;
-	u8 h14;
-	u8 h22;
-	u8 h23;
+	s8 m2;
+	s8 m3;
+	s8 h11;
+	s8 h12;
+	s8 h13;
+	s8 h14;
+	s8 h22;
+	s8 h23;
 };
 
Quoted 3 lines

arch/arm/include/asm/arch-omap5/clocks.h struct dpll_regs { · line 699

Quoted 1 line
arch/arm/include/asm/arch-omap5/clocks.h +0 -0
 extern struct omap5_prcm_regs *const prcm;

Make clock registers a signed type? whoa

No, we don't make registers a signed type. This is parameters structure for some parameter tables containing -1 as an indicator that the parameter shouldn't be written to the register. Using unsigned type for structure field results in parameter value 255:

static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
        {32, 0, 4, 3, 6, 4, -1, 2, -1, -1},             /* 12 MHz   */
        {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},       /* 13 MHz   */
        {160, 6, 4, 3, 6, 4, -1, 2, -1, -1},            /* 16.8 MHz */
        {20, 0, 4, 3, 6, 4, -1, 2, -1, -1},             /* 19.2 MHz */
        {192, 12, 4, 3, 6, 4, -1, 2, -1, -1},           /* 26 MHz   */
        {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},       /* 27 MHz   */
        {10, 0, 4, 3, 6, 4, -1, 2, -1, -1}              /* 38.4 MHz */
};

The code then checks:

void setup_post_dividers(u32 *const base, const struct dpll_params *params)

{
        struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;
        
        /* Setup post-dividers */
        if (params->m2 >= 0)
                writel(params->m2, &dpll_regs->cm_div_m2_dpll);
        if (params->m3 >= 0)
                writel(params->m3, &dpll_regs->cm_div_m3_dpll);
        if (params->h11 >= 0)
                writel(params->h11, &dpll_regs->cm_div_h11_dpll);
        if (params->h12 >= 0)
                writel(params->h12, &dpll_regs->cm_div_h12_dpll);
        if (params->h13 >= 0)
                writel(params->h13, &dpll_regs->cm_div_h13_dpll);
        if (params->h14 >= 0)
                writel(params->h14, &dpll_regs->cm_div_h14_dpll);
        if (params->h22 >= 0)
                writel(params->h22, &dpll_regs->cm_div_h22_dpll);
        if (params->h23 >= 0)
                writel(params->h23, &dpll_regs->cm_div_h23_dpll);
}

The result is that the registers will always be written to, since the comparison is always true. This is apparently not intended in the code.

The actual registers structure 'struct dpll_regs' uses unsigned type.

This sneaked in in the commit 2e5ba489 adding omap5 clock support. The similar parameter structure for omap4 used signed type for the fields in question.

Newer gcc doesn't warn here unless -Wextra option is used.

Thanks,
Anatolij

#32 lore raw

PATCH 9/9 arch/arm/include/asm/arch-omap5/clocks.h: Fix GCC 4.2 warnings

Quoted 111 lines · Anatolij Gustschin
Quoted 60 lines · On Sun, 4 Dec 2011 12:30:40 +0100 Marek Vasut <[email protected]> wrote:
Quoted 60 lines

Fix:
clocks.c: In function 'setup_post_dividers':
clocks.c:175: warning: comparison is always true due to limited range of data type
clocks.c:177: warning: comparison is always true due to limited range of data type
clocks.c:179: warning: comparison is always true due to limited range of data type
clocks.c:181: warning: comparison is always true due to limited range of data type
clocks.c:183: warning: comparison is always true due to limited range of data type
clocks.c:185: warning: comparison is always true due to limited range of data type
clocks.c:187: warning: comparison is always true due to limited range of data type
clocks.c:189: warning: comparison is always true due to limited range of data type

---
Some notes:

- GCC v4.5.1 didn't warn here
- GCC v4.6.1 seems to have a bug and can't compile this code:
clocks.c: In function 'enable_non_essential_clocks':
clocks.c:349:13: internal compiler error: in decode_addr_const, at
varasm.c:2632

 arch/arm/include/asm/arch-omap5/clocks.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-omap5/clocks.h index fa99f65..d0e6dd6 100644

arch/arm/include/asm/arch-omap5/clocks.h +8 -8
@@ -686,14 +686,14 @@ struct dpll_regs {
 struct dpll_params {
 	u32 m;
 	u32 n;
-	u8 m2;
-	u8 m3;
-	u8 h11;
-	u8 h12;
-	u8 h13;
-	u8 h14;
-	u8 h22;
-	u8 h23;
+	s8 m2;
+	s8 m3;
+	s8 h11;
+	s8 h12;
+	s8 h13;
+	s8 h14;
+	s8 h22;
+	s8 h23;
 };
 
Quoted 3 lines

arch/arm/include/asm/arch-omap5/clocks.h struct dpll_regs { · line 699

Quoted 1 line
arch/arm/include/asm/arch-omap5/clocks.h +0 -0
 extern struct omap5_prcm_regs *const prcm;

Make clock registers a signed type? whoa

No, we don't make registers a signed type. This is parameters structure for some parameter tables containing -1 as an indicator that the parameter shouldn't be written to the register. Using unsigned type for structure field results in parameter value 255:

static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
        {32, 0, 4, 3, 6, 4, -1, 2, -1, -1},             /* 12 MHz   */
        {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},       /* 13 MHz   */
        {160, 6, 4, 3, 6, 4, -1, 2, -1, -1},            /* 16.8 MHz */
        {20, 0, 4, 3, 6, 4, -1, 2, -1, -1},             /* 19.2 MHz */
        {192, 12, 4, 3, 6, 4, -1, 2, -1, -1},           /* 26 MHz   */
        {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},       /* 27 MHz   */
        {10, 0, 4, 3, 6, 4, -1, 2, -1, -1}              /* 38.4 MHz */
};

The code then checks:

void setup_post_dividers(u32 *const base, const struct dpll_params *params)

{
        struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;
        
        /* Setup post-dividers */
        if (params->m2 >= 0)
                writel(params->m2, &dpll_regs->cm_div_m2_dpll);
        if (params->m3 >= 0)
                writel(params->m3, &dpll_regs->cm_div_m3_dpll);
        if (params->h11 >= 0)
                writel(params->h11, &dpll_regs->cm_div_h11_dpll);
        if (params->h12 >= 0)
                writel(params->h12, &dpll_regs->cm_div_h12_dpll);
        if (params->h13 >= 0)
                writel(params->h13, &dpll_regs->cm_div_h13_dpll);
        if (params->h14 >= 0)
                writel(params->h14, &dpll_regs->cm_div_h14_dpll);
        if (params->h22 >= 0)
                writel(params->h22, &dpll_regs->cm_div_h22_dpll);
        if (params->h23 >= 0)
                writel(params->h23, &dpll_regs->cm_div_h23_dpll);
}

The result is that the registers will always be written to, since the comparison is always true. This is apparently not intended in the code.

Quoted 7 lines

The actual registers structure 'struct dpll_regs' uses unsigned type.

This sneaked in in the commit 2e5ba489 adding omap5 clock support. The similar parameter structure for omap4 used signed type for the fields in question.

Newer gcc doesn't warn here unless -Wextra option is used.

Sricharan, my examination, this analysis is correct, can you confirm that omap5 is supposed to work like omap4 in this case? Thanks.

Signature · 1 line
Tom
#33 lore raw

PATCH 9/9 arch/arm/include/asm/arch-omap5/clocks.h: Fix GCC 4.2 warnings

Hi Tom,
I agree on this. This was a bug.
My gcc was on version 4.4.4 and did not see any warnings here.

Thanks,
Sricharan

Quoted 136 lines · Tom Rini
Quoted 6 lines · Anatolij Gustschin
Quoted 3 lines · On Sun, 4 Dec 2011 12:30:40 +0100 Marek Vasut <[email protected]> wrote:
Quoted 3 lines

Fix:
clocks.c: In function 'setup_post_dividers':
clocks.c:175: warning: comparison is always true due to limited range

of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

data type
clocks.c:177: warning: comparison is always true due to limited range

of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

data type
clocks.c:179: warning: comparison is always true due to limited range

of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

data type
clocks.c:181: warning: comparison is always true due to limited range

of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

data type
clocks.c:183: warning: comparison is always true due to limited range

of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

data type
clocks.c:185: warning: comparison is always true due to limited range

of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

data type
clocks.c:187: warning: comparison is always true due to limited range

of

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

data type
clocks.c:189: warning: comparison is always true due to limited range

of

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

data type

---
Some notes:

- GCC v4.5.1 didn't warn here
- GCC v4.6.1 seems to have a bug and can't compile this code:
clocks.c: In function 'enable_non_essential_clocks':
clocks.c:349:13: internal compiler error: in decode_addr_const, at
varasm.c:2632

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
 arch/arm/include/asm/arch-omap5/clocks.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-omap5/clocks.h index fa99f65..d0e6dd6

100644

Quoted 43 lines
Quoted 24 lines
Quoted 24 lines
arch/arm/include/asm/arch-omap5/clocks.h +8 -8
@@ -686,14 +686,14 @@ struct dpll_regs {
 struct dpll_params {
    u32 m;
    u32 n;
-   u8 m2;
-   u8 m3;
-   u8 h11;
-   u8 h12;
-   u8 h13;
-   u8 h14;
-   u8 h22;
-   u8 h23;
+   s8 m2;
+   s8 m3;
+   s8 h11;
+   s8 h12;
+   s8 h13;
+   s8 h14;
+   s8 h22;
+   s8 h23;
 };
 
Quoted 3 lines

arch/arm/include/asm/arch-omap5/clocks.h struct dpll_regs { · line 699

Quoted 1 line
arch/arm/include/asm/arch-omap5/clocks.h +0 -0
 extern struct omap5_prcm_regs *const prcm;

Make clock registers a signed type? whoa

No, we don't make registers a signed type. This is parameters structure for some parameter tables containing -1 as an indicator that the parameter shouldn't be written to the register. Using unsigned type for structure field results in parameter value 255:

static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
        {32, 0, 4, 3, 6, 4, -1, 2, -1, -1},             /* 12 MHz   */
        {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},       /* 13 MHz   */
        {160, 6, 4, 3, 6, 4, -1, 2, -1, -1},            /* 16.8 MHz */
        {20, 0, 4, 3, 6, 4, -1, 2, -1, -1},             /* 19.2 MHz */
        {192, 12, 4, 3, 6, 4, -1, 2, -1, -1},           /* 26 MHz   */
        {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},       /* 27 MHz   */
        {10, 0, 4, 3, 6, 4, -1, 2, -1, -1}              /* 38.4 MHz */
};
Quoted 3 lines

The code then checks:

void setup_post_dividers(u32 *const base, const struct dpll_params

*params)

Quoted 26 lines
{
        struct dpll_regs *const dpll_regs = (struct dpll_regs *)base;

        /* Setup post-dividers */
        if (params->m2 >= 0)
                writel(params->m2, &dpll_regs->cm_div_m2_dpll);
        if (params->m3 >= 0)
                writel(params->m3, &dpll_regs->cm_div_m3_dpll);
        if (params->h11 >= 0)
                writel(params->h11, &dpll_regs->cm_div_h11_dpll);
        if (params->h12 >= 0)
                writel(params->h12, &dpll_regs->cm_div_h12_dpll);
        if (params->h13 >= 0)
                writel(params->h13, &dpll_regs->cm_div_h13_dpll);
        if (params->h14 >= 0)
                writel(params->h14, &dpll_regs->cm_div_h14_dpll);
        if (params->h22 >= 0)
                writel(params->h22, &dpll_regs->cm_div_h22_dpll);
        if (params->h23 >= 0)
                writel(params->h23, &dpll_regs->cm_div_h23_dpll);
}

The result is that the registers will always be written to, since the comparison is always true. This is apparently not intended in the code.

Quoted 7 lines

The actual registers structure 'struct dpll_regs' uses unsigned type.

This sneaked in in the commit 2e5ba489 adding omap5 clock support. The similar parameter structure for omap4 used signed type for the fields in question.

Newer gcc doesn't warn here unless -Wextra option is used.

Sricharan, my examination, this analysis is correct, can you confirm that omap5 is supposed to work like omap4 in this case? Thanks.

--
Tom

#34 lore raw

PATCH 1/9 common/menu.c: Fix build warning

In reply to Anatolij Gustschin

Hello Anatolij,

Quoted 9 lines · Anatolij Gustschin

Fix:
menu.c: In function 'menu_item_print':
menu.c:91: warning: passing argument 1 of 'putc' makes integer from pointer without a cast

---
 common/menu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, had the same patch in my queue ;-)

Tested on the cam_enc_4xx board, so also a:

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#35 lore raw

PATCH 1/9 common/menu.c: Fix build warning

In reply to Anatolij Gustschin
Quoted 15 lines

Fix:
menu.c: In function 'menu_item_print':
menu.c:91: warning: passing argument 1 of 'putc' makes integer from pointer without a cast

---
 common/menu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/menu.c +0 -0
index ca1baef..5e0817c 100644

common/menu.c static inline void *menu_item_print(struct menu *m, · line 94

Quoted 8 lines
common/menu.c +1 -1
@@ -88,7 +88,7 @@ static inline void *menu_item_print(struct menu *m,
 				void *extra)
 {
 	if (!m->item_data_print) {
-		putc(item->key);
+		puts(item->key);
 		putc('\n');
 	} else {
 		m->item_data_print(item->data);

I see printf("%s\n", item->key); in there ... you might have some newer version though. Please recheck and if that's the case:

#36 lore raw

PATCH 1/9 common/menu.c: Fix build warning

Hi Marek,

On Sun, 4 Dec 2011 12:27:26 +0100
Marek Vasut <[email protected]> wrote:
...

Quoted 8 lines
Quoted 8 lines
common/menu.c +0 -0
index ca1baef..5e0817c 100644
@@ -88,7 +88,7 @@ static inline void *menu_item_print(struct menu *m,
 				void *extra)
 {
 	if (!m->item_data_print) {
Quoted 8 lines

common/menu.c static inline void *menu_item_print(struct menu *m, · line 94

Quoted 5 lines
common/menu.c +1 -1
-		putc(item->key);
+		puts(item->key);
 		putc('\n');
 	} else {
 		m->item_data_print(item->data);

I see printf("%s\n", item->key); in there ... you might have some newer version though. Please recheck and if that's the case:

I've the newer version from u-boot.git master branch.

Thanks,
Anatolij

#37 lore raw

PATCH 1/9 common/menu.c: Fix build warning

In reply to Anatolij Gustschin

Dear Anatolij Gustschin,

Quoted 9 lines · In message <[email protected]> you wrote:

Fix:
menu.c: In function 'menu_item_print':
menu.c:91: warning: passing argument 1 of 'putc' makes integer from pointer without a cast

---
 common/menu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Real computer scientists don't comment their  code.  The  identifiers
are so long they can't afford the disk space.