Skip to contentSkip to conversation

arch/arm/lib/board.c: fix warning: variable ... set but not used

PATCH New Wolfgang Denk 4 participants 21 messages Oct 5, 2011 – Oct 9, 2011

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

PATCH 1/7 arch/arm/lib/board.c: fix warning: variable ... set but not used

Fix:
board.c:445:8: warning: variable 'bd' set but not used [-Wunused-but-set-variable]

---
 arch/arm/lib/board.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/lib/board.c +0 -2
index 705d4d2..b266f78 100644
@@ -442,14 +442,12 @@ static char *failed = "*** failed ***\n";
 void board_init_r(gd_t *id, ulong dest_addr)
 {
 	char *s;
-	bd_t *bd;
 	ulong malloc_start;
 #if !defined(CONFIG_SYS_NO_FLASH)
 	ulong flash_size;
 #endif
 
 	gd = id;
-	bd = gd->bd;
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
Signature · 1 line
1.7.6.2
author Applied
#1 lore raw

PATCH 1/7 arch/arm/lib/board.c: fix warning: variable ... set but not used

Dear Wolfgang Denk,

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

Fix:
board.c:445:8: warning: variable 'bd' set but not used [-Wunused-but-set-variable]

---
 arch/arm/lib/board.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 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
Anyone who knows history, particularly the history of Europe, will, I
think, recognize that the domination of education or of government by
any one particular religious faith is never a happy  arrangement  for
the people.                                       - Eleanor Roosevelt
#2 lore raw

PATCH 2/7 CFI: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Fix:
cfi_mtd.c: In function 'cfi_mtd_init':
cfi_mtd.c:226:19: warning: variable 'mtd_list' set but not used [-Wunused-but-set-variable] cfi_mtd.c: In function 'cfi_mtd_init':
cfi_mtd.c:226:19: warning: variable 'mtd_list' set but not used [-Wunused-but-set-variable]

---
 common/cmd_mtdparts.c |    9 +++++++--
 drivers/mtd/cfi_mtd.c |    4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)
common/cmd_mtdparts.c +7 -2
index 5481c88..2c2e4e0 100644
@@ -838,7 +838,10 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_
 	struct mtdids *id;
 	const char *mtd_id;
 	unsigned int mtd_id_len;
-	const char *p, *pend;
+	const char *p;
+#ifdef DEBUG
+	const char *pend;
+#endif
 	LIST_HEAD(tmp_list);
 	struct list_head *entry, *n;
 	u16 num_parts;
@@ -868,10 +871,12 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_
 		return 1;
 	}
 
+#ifdef DEBUG
+	pend = strchr(p, ';');
+#endif
 	debug("dev type = %d (%s), dev num = %d, mtd-id = %s\n",
 			id->type, MTD_DEV_TYPE(id->type),
 			id->num, id->mtd_id);
-	pend = strchr(p, ';');
 	debug("parsing partitions %.*s\n", (pend ? pend - p : strlen(p)), p);
 
 
drivers/mtd/cfi_mtd.c +4 -0
index cbcc165..7796c4c 100644
@@ -223,7 +223,9 @@ int cfi_mtd_init(void)
 	flash_info_t *fi;
 	int error, i;
 	int devices_found = 0;
+#ifdef CONFIG_MTD_CONCAT
 	struct mtd_info *mtd_list[CONFIG_SYS_MAX_FLASH_BANKS];
+#endif
 
 	for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
 		fi = &flash_info[i];
@@ -253,7 +255,9 @@ int cfi_mtd_init(void)
 		if (add_mtd_device(mtd))
 			return -ENOMEM;
 
+#ifdef CONFIG_MTD_CONCAT
 		mtd_list[devices_found++] = mtd;
+#endif
 	}
 
 #ifdef CONFIG_MTD_CONCAT
Signature · 1 line
1.7.6.2
#3 lore raw

PATCH 2/7 CFI: fix warning: variable ... set but not used

Hi Wolfgang,

Quoted 9 lines · On Wednesday 05 October 2011 23:17:28 Wolfgang Denk wrote:

Fix:
cfi_mtd.c: In function 'cfi_mtd_init':
cfi_mtd.c:226:19: warning: variable 'mtd_list' set but not used [-Wunused-but-set-variable] cfi_mtd.c: In function 'cfi_mtd_init':
cfi_mtd.c:226:19: warning: variable 'mtd_list' set but not used [-Wunused-but-set-variable]

Feel free to apply directly if this is easier for you.

Thanks,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#4 lore raw

PATCH 2/7 CFI: fix warning: variable ... set but not used

Dear Stefan Roese,

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

Feel free to apply directly if this is easier for you.

Thanks, but actually the patch is incomplete; there is another similar place that needs fixing, too.

Will send a v2 soon.

Best regards,

Wolfgang Denk

Signature · 4 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
"The lesser of two evils -- is evil."             - Seymour (Sy) Leon
#5 lore raw

PATCH 2/7 CFI: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Dear Wolfgang Denk,

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

Fix:
cfi_mtd.c: In function 'cfi_mtd_init':
cfi_mtd.c:226:19: warning: variable 'mtd_list' set but not used [-Wunused-but-set-variable] cfi_mtd.c: In function 'cfi_mtd_init':
cfi_mtd.c:226:19: warning: variable 'mtd_list' set but not used [-Wunused-but-set-variable]

Quoted 6 lines
---
 common/cmd_mtdparts.c |    9 +++++++--
 drivers/mtd/cfi_mtd.c |    4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)

Applied (with changes to fix the other issue, too).

Best regards,

Wolfgang Denk

Signature · 6 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
Is truth not truth for all?
	-- Natira, "For the World is Hollow and I have Touched
		   the Sky", stardate 5476.4.
#6 lore raw

PATCH 3/7 fs/jffs2/jffs2_1pass.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Fix:
jffs2_1pass.c: In function 'jffs2_1pass_read_inode':
jffs2_1pass.c:699:7: warning: variable 'ret' set but not used [-Wunused-but-set-variable] jffs2_1pass.c: In function 'jffs2_1pass_build_lists':
jffs2_1pass.c:1578:14: warning: variable 'empty_start' set but not used [-Wunused-but-set-variable]

---
 fs/jffs2/jffs2_1pass.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
fs/jffs2/jffs2_1pass.c +4 -10
index 5ddc2b9..a0b02e4 100644
@@ -696,7 +696,6 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
 	u32 latestVersion = 0;
 	uchar *lDest;
 	uchar *src;
-	long ret;
 	int i;
 	u32 counter = 0;
 #ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
@@ -768,28 +767,25 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
 #endif
 				switch (jNode->compr) {
 				case JFFS2_COMPR_NONE:
-					ret = (unsigned long) ldr_memcpy(lDest, src, jNode->dsize);
+					ldr_memcpy(lDest, src, jNode->dsize);
 					break;
 				case JFFS2_COMPR_ZERO:
-					ret = 0;
 					for (i = 0; i < jNode->dsize; i++)
 						*(lDest++) = 0;
 					break;
 				case JFFS2_COMPR_RTIME:
-					ret = 0;
 					rtime_decompress(src, lDest, jNode->csize, jNode->dsize);
 					break;
 				case JFFS2_COMPR_DYNRUBIN:
 					/* this is slow but it works */
-					ret = 0;
 					dynrubin_decompress(src, lDest, jNode->csize, jNode->dsize);
 					break;
 				case JFFS2_COMPR_ZLIB:
-					ret = zlib_decompress(src, lDest, jNode->csize, jNode->dsize);
+					zlib_decompress(src, lDest, jNode->csize, jNode->dsize);
 					break;
 #if defined(CONFIG_JFFS2_LZO)
 				case JFFS2_COMPR_LZO:
-					ret = lzo_decompress(src, lDest, jNode->csize, jNode->dsize);
+					lzo_decompress(src, lDest, jNode->csize, jNode->dsize);
 					break;
 #endif
 				default:
@@ -803,7 +799,6 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
 
 #if 0
 			putLabeledWord("read_inode: totalSize = ", totalSize);
-			putLabeledWord("read_inode: compr ret = ", ret);
 #endif
 		}
 		counter++;
@@ -1575,9 +1570,8 @@ jffs2_1pass_build_lists(struct part_info * part)
 
 			if (*(uint32_t *)(&buf[ofs-buf_ofs]) == 0xffffffff) {
 				uint32_t inbuf_ofs;
-				uint32_t empty_start, scan_end;
+				uint32_t scan_end;
 
-				empty_start = ofs;
 				ofs += 4;
 				scan_end = min_t(uint32_t, EMPTY_SCAN_SIZE(
 							part->sector_size)/8,
Signature · 1 line
1.7.6.2
author Applied
#7 lore raw

PATCH 3/7 fs/jffs2/jffs2_1pass.c: fix warning: variable ... set but not used

Dear Wolfgang Denk,

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

Fix:
jffs2_1pass.c: In function 'jffs2_1pass_read_inode':
jffs2_1pass.c:699:7: warning: variable 'ret' set but not used [-Wunused-but-set-variable] jffs2_1pass.c: In function 'jffs2_1pass_build_lists':
jffs2_1pass.c:1578:14: warning: variable 'empty_start' set but not used [-Wunused-but-set-variable]

---
 fs/jffs2/jffs2_1pass.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
If all you have is a hammer, everything looks like a nail.
#8 lore raw

PATCH 4/7 drivers/net/smc91111.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Fix:
smc91111.c: In function 'smc_phy_configure':
smc91111.c:1194:6: warning: variable 'failed' set but not used [-Wunused-but-set-variable] smc91111.c:1190:7: warning: variable 'phyaddr' set but not used [-Wunused-but-set-variable]

---
 drivers/net/smc91111.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/net/smc91111.c +0 -8
index ba9c67e..9b8236d 100644
@@ -1187,18 +1187,12 @@ static void smc_wait_ms(unsigned int ms)
 static void smc_phy_configure (struct eth_device *dev)
 {
 	int timeout;
-	byte phyaddr;
 	word my_phy_caps;	/* My PHY capabilities */
 	word my_ad_caps;	/* My Advertised capabilities */
 	word status = 0;	/*;my status = 0 */
-	int failed = 0;
 
 	PRINTK3 ("%s: smc_program_phy()\n", SMC_DEV_NAME);
 
-
-	/* Get the detected phy address */
-	phyaddr = SMC_PHY_ADDR;
-
 	/* Reset the PHY, setting all other bits to zero */
 	smc_write_phy_register (dev, PHY_CNTL_REG, PHY_CNTL_RST);
 
@@ -1296,13 +1290,11 @@ static void smc_phy_configure (struct eth_device *dev)
 
 	if (timeout < 1) {
 		printf ("%s: PHY auto-negotiate timed out\n", SMC_DEV_NAME);
-		failed = 1;
 	}
 
 	/* Fail if we detected an auto-negotiate remote fault */
 	if (status & PHY_STAT_REM_FLT) {
 		printf ("%s: PHY remote fault detected\n", SMC_DEV_NAME);
-		failed = 1;
 	}
 
 	/* Re-Configure the Receive/Phy Control register */
Signature · 1 line
1.7.6.2
author Applied
#9 lore raw

PATCH 4/7 drivers/net/smc91111.c: fix warning: variable ... set but not used

Dear Wolfgang Denk,

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

Fix:
smc91111.c: In function 'smc_phy_configure':
smc91111.c:1194:6: warning: variable 'failed' set but not used [-Wunused-but-set-variable] smc91111.c:1190:7: warning: variable 'phyaddr' set but not used [-Wunused-but-set-variable]

---
 drivers/net/smc91111.c |    8 --------
 1 files changed, 0 insertions(+), 8 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
The price of curiosity is a terminal experience.
                         - Terry Pratchett, _The Dark Side of the Sun_
#10 lore raw

PATCH 5/7 common/cmd_usb.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Fix:
cmd_usb.c: In function 'usb_show_tree_graph':
cmd_usb.c:284:29: warning: variable 'port' set but not used [-Wunused-but-set-variable]

---
 common/cmd_usb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
common/cmd_usb.c +1 -2
index cd4d417..8c87265 100644
@@ -281,7 +281,7 @@ static inline char *portspeed(int speed)
 void usb_show_tree_graph(struct usb_device *dev, char *pre)
 {
 	int i, index;
-	int has_child, last_child, port;
+	int has_child, last_child;
 
 	index = strlen(pre);
 	printf(" %s", pre);
@@ -300,7 +300,6 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre)
 				/* found our pointer, see if we have a
 				 * little sister
 				 */
-				port = i;
 				while (i++ < dev->parent->maxchild) {
 					if (dev->parent->children[i] != NULL) {
 						/* found a sister */
Signature · 1 line
1.7.6.2
#11 lore raw

PATCH 5/7 common/cmd_usb.c: fix warning: variable ... set but not used

Hi,

2011/10/5 Wolfgang Denk <[email protected]>:

Quoted 10 lines

Fix:
cmd_usb.c: In function 'usb_show_tree_graph':
cmd_usb.c:284:29: warning: variable 'port' set but not used [-Wunused-but-set-variable]

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

Kind regards,

Remy

author Applied
#12 lore raw

PATCH 5/7 common/cmd_usb.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Dear Wolfgang Denk,

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

Fix:
cmd_usb.c: In function 'usb_show_tree_graph':
cmd_usb.c:284:29: warning: variable 'port' set but not used [-Wunused-but-set-variable]

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

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
You are only young once, but you can stay immature indefinitely.
#13 lore raw

PATCH 6/7 drivers/usb/host/ohci-hcd.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Fix:
ohci-hcd.c: In function 'dl_transfer_length':
ohci-hcd.c:968:8: warning: variable 'tdINFO' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/host/ohci-hcd.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-hcd.c +1 -2
index bc8bb20..c20d706 100644
@@ -965,10 +965,9 @@ static void td_submit_job(struct usb_device *dev, unsigned long pipe,
 
 static void dl_transfer_length(td_t *td)
 {
-	__u32 tdINFO, tdBE, tdCBP;
+	__u32 tdBE, tdCBP;
 	urb_priv_t *lurb_priv = td->ed->purb;
 
-	tdINFO = m32_swap(td->hwINFO);
 	tdBE   = m32_swap(td->hwBE);
 	tdCBP  = m32_swap(td->hwCBP);
 
Signature · 1 line
1.7.6.2
#14 lore raw

PATCH 6/7 drivers/usb/host/ohci-hcd.c: fix warning: variable ... set but not used

Hi,

2011/10/5 Wolfgang Denk <[email protected]>:

Quoted 10 lines

Fix:
ohci-hcd.c: In function 'dl_transfer_length':
ohci-hcd.c:968:8: warning: variable 'tdINFO' set but not used [-Wunused-but-set-variable]

---
?drivers/usb/host/ohci-hcd.c | ? ?3 +--
?1 files changed, 1 insertions(+), 2 deletions(-)

Kind regards,

Remy

author Applied
#15 lore raw

PATCH 6/7 drivers/usb/host/ohci-hcd.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Dear Wolfgang Denk,

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

Fix:
ohci-hcd.c: In function 'dl_transfer_length':
ohci-hcd.c:968:8: warning: variable 'tdINFO' set but not used [-Wunused-but-set-variable]

---
 drivers/usb/host/ohci-hcd.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 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
The shortest unit of time in the multiverse is the News York  Second,
defined  as  the  period  of  time between the traffic lights turning
green and the cab behind you honking.
                                - Terry Pratchett, _Lords and Ladies_
#16 lore raw

PATCH 1/7 arch/arm/lib/board.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Hi Wolfgang,

Quoted 23 lines · Wolfgang Denk

Fix:
board.c:445:8: warning: variable 'bd' set but not used [-Wunused-but-set-variable]

---
?arch/arm/lib/board.c | ? ?2 --
?1 files changed, 0 insertions(+), 2 deletions(-)

arch/arm/lib/board.c +0 -1
index 705d4d2..b266f78 100644
@@ -442,14 +442,12 @@ static char *failed = "*** failed ***\n";
 ?void board_init_r(gd_t *id, ulong dest_addr)
 ?{
 ? ? ? ?char *s;
- ? ? ? bd_t *bd;
 ? ? ? ?ulong malloc_start;
 ?#if !defined(CONFIG_SYS_NO_FLASH)
 ? ? ? ?ulong flash_size;

?#endif

Quoted 4 lines

? ? ? ?gd = id;
- ? ? ? bd = gd->bd;

? ? ? ?gd->flags |= GD_FLG_RELOC; ? ? ?/* tell others: relocation done */

Sorry if I have missed a mailing list patch, but in my version of the source there is a line a little lower down which uses bd:

       mmc_initialize(bd);

Of course it can just become gd->bd so there is no problem removing the variable.

Regards,
Simon

Quoted 9 lines

--
1.7.6.2

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#17 lore raw

PATCH 1/7 arch/arm/lib/board.c: fix warning: variable ... set but not used

Dear Simon Glass,

Quoted 8 lines · In message <CAPnjgZ2okU0d5KzjHJnQar2Zi_8y0Fsp1pSkpCy5GSdeY1iPCg@mail.gmail.com>…

Sorry if I have missed a mailing list patch, but in my version of the source there is a line a little lower down which uses bd:

       mmc_initialize(bd);

Of course it can just become gd->bd so there is no problem removing the variable.

You are right - thanks for pointing out. Fixed when checking in.

Best regards,

Wolfgang Denk

Signature · 6 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
If I don't document something, it's usually either for a good reason,
or a bad reason.  In this case it's a good reason.  :-)
                 - Larry Wall in <[email protected]>
#18 lore raw

PATCH 7/7 common/usb.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Fix:
usb.c: In function 'usb_parse_config':
usb.c:331:17: warning: variable 'ch' set but not used [-Wunused-but-set-variable] usb.c: In function 'usb_hub_port_connect_change':
usb.c:1123:29: warning: variable 'portchange' set but not used [-Wunused-but-set-variable] usb.c: In function 'usb_hub_configure':
usb.c:1183:25: warning: variable 'hubsts' set but not used [-Wunused-but-set-variable]

---
 common/usb.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
common/usb.c +13 -7
index a401c09..2cd50db 100644
@@ -328,7 +328,6 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
 	struct usb_descriptor_header *head;
 	int index, ifno, epno, curr_if_num;
 	int i;
-	unsigned char *ch;
 
 	ifno = -1;
 	epno = -1;
@@ -386,7 +385,9 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
 				   head->bDescriptorType);
 
 			{
-				ch = (unsigned char *)head;
+#ifdef USB_DEBUG
+				unsigned char *ch = (unsigned char *)head;
+#endif
 				for (i = 0; i < head->bLength; i++)
 					USB_PRINTF("%02X ", *ch++);
 				USB_PRINTF("\n\n\n");
@@ -1120,7 +1121,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
 {
 	struct usb_device *usb;
 	struct usb_port_status portsts;
-	unsigned short portstatus, portchange;
+	unsigned short portstatus;
 
 	/* Check status */
 	if (usb_get_port_status(dev, port + 1, &portsts) < 0) {
@@ -1129,9 +1130,10 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
 	}
 
 	portstatus = le16_to_cpu(portsts.wPortStatus);
-	portchange = le16_to_cpu(portsts.wPortChange);
 	USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
-			portstatus, portchange, portspeed(portstatus));
+			portstatus,
+			le16_to_cpu(portsts.wPortChange),
+			portspeed(portstatus));
 
 	/* Clear the connection change status */
 	usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION);
@@ -1178,11 +1180,13 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
 
 int usb_hub_configure(struct usb_device *dev)
 {
+	int i;
 	unsigned char buffer[USB_BUFSIZ], *bitmap;
 	struct usb_hub_descriptor *descriptor;
-	struct usb_hub_status *hubsts;
-	int i;
 	struct usb_hub_device *hub;
+#ifdef USB_HUB_DEBUG
+	struct usb_hub_status *hubsts;
+#endif
 
 	/* "allocate" Hub device */
 	hub = usb_hub_allocate();
@@ -1284,7 +1288,9 @@ int usb_hub_configure(struct usb_device *dev)
 		return -1;
 	}
 
+#ifdef USB_HUB_DEBUG
 	hubsts = (struct usb_hub_status *)buffer;
+#endif
 	USB_HUB_PRINTF("get_hub_status returned status %X, change %X\n",
 			le16_to_cpu(hubsts->wHubStatus),
 			le16_to_cpu(hubsts->wHubChange));
Signature · 1 line
1.7.6.2
#19 lore raw

PATCH 7/7 common/usb.c: fix warning: variable ... set but not used

Hi,

2011/10/5 Wolfgang Denk <[email protected]>:

Quoted 8 lines

Fix:
usb.c: In function 'usb_parse_config':
usb.c:331:17: warning: variable 'ch' set but not used [-Wunused-but-set-variable] usb.c: In function 'usb_hub_port_connect_change':
usb.c:1123:29: warning: variable 'portchange' set but not used [-Wunused-but-set-variable] usb.c: In function 'usb_hub_configure':
usb.c:1183:25: warning: variable 'hubsts' set but not used [-Wunused-but-set-variable]

Quoted 6 lines

---
?common/usb.c | ? 20 +++++++++++++------- ?1 files changed, 13 insertions(+), 7 deletions(-)

Kind regards,

Remy

author Applied
#20 lore raw

PATCH 7/7 common/usb.c: fix warning: variable ... set but not used

In reply to Wolfgang Denk

Dear Wolfgang Denk,

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

Fix:
usb.c: In function 'usb_parse_config':
usb.c:331:17: warning: variable 'ch' set but not used [-Wunused-but-set-variable] usb.c: In function 'usb_hub_port_connect_change':
usb.c:1123:29: warning: variable 'portchange' set but not used [-Wunused-but-set-variable] usb.c: In function 'usb_hub_configure':
usb.c:1183:25: warning: variable 'hubsts' set but not used [-Wunused-but-set-variable]

Quoted 5 lines
---
 common/usb.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
God may be subtle, but He isn't plain mean.         - Albert Einstein