summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-08-09 09:43:40 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:27 -0700
commitdae320288dcda9cae8a98b885e16ba8251294840 (patch)
treee7c7b27e2f95517c536ea210704358738d5a676a /common
parent0c8b6583a0a9c23c9041c790a78ec6aaeb7d69dc (diff)
Fix compiler warnings generated by gcc 4.6.
The newer compiler version is more thorough in detecting code inconsistencies, and reports warnings in many cases when building u-boot for kaen and alex. This change modifies the code to get rid of the warnings. There supposed to be no logical changes, so no testing other than building the system is being done. The files not yet upstreamed are excluded and will be submitted separately. BUG=chromium-os:18862 TEST=manual . run the following commands emerge-tegra2_kaen chromeos-u-boot emerge-x86-alex chromeos-u-boot . observe them succeed Change-Id: I4c872d84352539d24a418ba910274d08d02d26a8 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/5706 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_ide.c2
-rw-r--r--common/cmd_mem.c4
-rw-r--r--common/cmd_nand.c4
-rw-r--r--common/cmd_nvedit.c3
-rw-r--r--common/cmd_usb.c3
-rw-r--r--common/lcd.c7
-rw-r--r--common/usb.c41
-rw-r--r--common/usb_storage.c7
8 files changed, 40 insertions, 31 deletions
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 21fe1eabadb..771297376f0 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -1002,7 +1002,6 @@ static void ide_ident (block_dev_desc_t *dev_desc)
#ifdef CONFIG_ATAPI
int retries = 0;
- int do_retry = 0;
#endif
#ifdef CONFIG_TUNE_PIO
@@ -1023,7 +1022,6 @@ static void ide_ident (block_dev_desc_t *dev_desc)
dev_desc->if_type=IF_TYPE_IDE;
#ifdef CONFIG_ATAPI
- do_retry = 0;
retries = 0;
/* Warning: This will be tricky to read */
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index a5576aaab00..960432f53eb 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -32,6 +32,7 @@
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
+#include <linux/compiler.h>
#include <watchdog.h>
#ifdef CMD_MEM_DEBUG
@@ -471,7 +472,8 @@ int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- ulong addr, length, i, junk;
+ ulong addr, length, i;
+ ulong junk __always_unused;
int size;
volatile uint *longp;
volatile ushort *shortp;
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 44c4d1f89ce..ef1253f50b5 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -466,8 +466,6 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
int clean = argc > 2 && !strcmp("clean", argv[2]);
int o = clean ? 3 : 2;
int scrub = !strncmp(cmd, "scrub", 5);
- int part = 0;
- int chip = 0;
int spread = 0;
int args = 2;
@@ -475,10 +473,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
if (!strcmp(&cmd[5], ".spread")) {
spread = 1;
} else if (!strcmp(&cmd[5], ".part")) {
- part = 1;
args = 1;
} else if (!strcmp(&cmd[5], ".chip")) {
- chip = 1;
args = 0;
} else {
goto usage;
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 673bfa1d121..b451f2853e5 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -459,7 +459,6 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char buffer[CONFIG_SYS_CBSIZE];
char *init_val;
- int len;
if (argc < 2)
return cmd_usage(cmdtp);
@@ -467,7 +466,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Set read buffer to initial value or empty sting */
init_val = getenv(argv[1]);
if (init_val)
- len = sprintf(buffer, "%s", init_val);
+ sprintf(buffer, "%s", init_val);
else
buffer[0] = '\0';
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 76474423f7c..e04f1c54790 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -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 */
diff --git a/common/lcd.c b/common/lcd.c
index ce93ba3c998..f95cab49230 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -243,10 +243,13 @@ void lcd_printf(const char *fmt, ...)
static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
{
uchar *dest;
- ushort off, row;
+ ushort row;
- dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
+#if LCD_BPP == LCD_MONOCHROME
+ ushort off;
off = x * (1 << LCD_BPP) % 8;
+#endif
+ dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
for (row=0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
uchar *s = str;
diff --git a/common/usb.c b/common/usb.c
index e099d4715d6..9ae6c292810 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -354,8 +354,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;
@@ -412,12 +410,15 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
USB_PRINTF("unknown Description Type : %x\n",
head->bDescriptorType);
+#ifdef USB_DEBUG
{
- ch = (unsigned char *)head;
+ int i;
+ unsigned char *ch = (unsigned char *)head;
for (i = 0; i < head->bLength; i++)
USB_PRINTF("%02X ", *ch++);
USB_PRINTF("\n\n\n");
}
+#endif
break;
}
index += head->bLength;
@@ -1217,7 +1218,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) {
@@ -1226,9 +1227,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);
@@ -1275,7 +1277,6 @@ int usb_hub_configure(struct usb_device *dev)
{
unsigned char buffer[USB_BUFSIZ], *bitmap;
struct usb_hub_descriptor *descriptor;
- struct usb_hub_status *hubsts;
int i;
struct usb_hub_device *hub;
@@ -1379,16 +1380,22 @@ int usb_hub_configure(struct usb_device *dev)
return -1;
}
- hubsts = (struct usb_hub_status *)buffer;
- USB_HUB_PRINTF("get_hub_status returned status %X, change %X\n",
- le16_to_cpu(hubsts->wHubStatus),
- le16_to_cpu(hubsts->wHubChange));
- USB_HUB_PRINTF("local power source is %s\n",
- (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_LOCAL_POWER) ? \
- "lost (inactive)" : "good");
- USB_HUB_PRINTF("%sover-current condition exists\n",
- (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? \
- "" : "no ");
+#ifdef USB_HUB_DEBUG
+ {
+ struct usb_hub_status *hubsts = (struct usb_hub_status *)buffer;
+ USB_HUB_PRINTF("get_hub_status returned status %X, change %X\n",
+ le16_to_cpu(hubsts->wHubStatus),
+ le16_to_cpu(hubsts->wHubChange));
+ USB_HUB_PRINTF("local power source is %s\n",
+ (le16_to_cpu(hubsts->wHubStatus) &
+ HUB_STATUS_LOCAL_POWER) ?
+ "lost (inactive)" : "good");
+ USB_HUB_PRINTF("%sover-current condition exists\n",
+ (le16_to_cpu(hubsts->wHubStatus) &
+ HUB_STATUS_OVERCURRENT) ?
+ "" : "no ");
+ }
+#endif
usb_hub_power_on(hub);
for (i = 0; i < dev->maxchild; i++) {
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 4a6f93975b9..2ce2dcd2b21 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -468,13 +468,18 @@ static int usb_stor_BBB_reset(struct us_data *us)
static int usb_stor_CB_reset(struct us_data *us)
{
unsigned char cmd[12];
+#ifdef USB_STOR_DEBUG
int result;
+#endif
USB_STOR_PRINTF("CB_reset\n");
memset(cmd, 0xff, sizeof(cmd));
cmd[0] = SCSI_SEND_DIAG;
cmd[1] = 4;
- result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
+#ifdef USB_STOR_DEBUG
+ result =
+#endif
+ usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
US_CBI_ADSC,
USB_TYPE_CLASS | USB_RECIP_INTERFACE,
0, us->ifnum, cmd, sizeof(cmd),