[U-Boot] [PATCH 7/7] common/usb.c: fix warning: variable ... set but not used

Wolfgang Denk wd at denx.de
Wed Oct 5 23:17:33 CEST 2011


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]

Signed-off-by: Wolfgang Denk <wd at denx.de>
Cc: Remy Bohmer <linux at bohmer.net>
---
 common/usb.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index a401c09..2cd50db 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -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));
-- 
1.7.6.2



More information about the U-Boot mailing list