[U-Boot-Users] [PATCH 0/2] Fix warning differ in signedness in common/cmd_ide.c

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
diff --git a/common/cmd_ide.c b/common/cmd_ide.c index bb064ea..27cecac 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -1136,9 +1136,9 @@ static void ide_ident (block_dev_desc_t *dev_desc)
input_swap_data (device, iobuf, ATA_SECTORWORDS);
- ident_cpy (dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision)); - ident_cpy (dev_desc->vendor, iop->model, sizeof(dev_desc->vendor)); - ident_cpy (dev_desc->product, iop->serial_no, sizeof(dev_desc->product)); + ident_cpy ((unsigned char*)dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision)); + ident_cpy ((unsigned char*)dev_desc->vendor, iop->model, sizeof(dev_desc->vendor)); + ident_cpy ((unsigned char*)dev_desc->product, iop->serial_no, sizeof(dev_desc->product)); #ifdef __LITTLE_ENDIAN /* * firmware revision and model number have Big Endian Byte @@ -1953,9 +1953,9 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc) return;
/* copy device ident strings */ - ident_cpy(dev_desc->vendor,&iobuf[8],8); - ident_cpy(dev_desc->product,&iobuf[16],16); - ident_cpy(dev_desc->revision,&iobuf[32],5); + ident_cpy((unsigned char*)dev_desc->vendor,&iobuf[8],8); + ident_cpy((unsigned char*)dev_desc->product,&iobuf[16],16); + ident_cpy((unsigned char*)dev_desc->revision,&iobuf[32],5);
dev_desc->lun=0; dev_desc->lba=0;

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
diff --git a/net/net.c b/net/net.c index cde2680..f3c70c5 100644 --- a/net/net.c +++ b/net/net.c @@ -598,7 +598,7 @@ void NetStartAgain (void) if (NetRestartWrap) { NetRestartWrap = 0; if (NetDevExists && !once) { - NetSetTimeout (10 * CFG_HZ, startAgainTimeout); + NetSetTimeout ((ulong)10 * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler); } else { NetState = NETLOOP_FAIL; diff --git a/net/nfs.c b/net/nfs.c index 1b27c97..18b00cc 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -669,7 +669,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
case STATE_READ_REQ: rlen = nfs_read_reply (pkt, len); - NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout); + NetSetTimeout ((ulong)NFS_TIMEOUT * CFG_HZ, NfsTimeout); if (rlen > 0) { nfs_offset += rlen; NfsSend (); @@ -758,7 +758,7 @@ NfsStart (void) printf ("\nLoad address: 0x%lx\n" "Loading: *\b", load_addr);
- NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout); + NetSetTimeout ((ulong)NFS_TIMEOUT * CFG_HZ, NfsTimeout); NetSetHandler (NfsHandler);
NfsTimeoutCount = 0;

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
diff --git a/board/purple/flash.c b/board/purple/flash.c index 7522580..1baae35 100644 --- a/board/purple/flash.c +++ b/board/purple/flash.c @@ -299,7 +299,7 @@ void flash_print_info (flash_info_t *info) int i; uchar *boottype; uchar *bootletter; - uchar *fmt; + char *fmt; uchar botbootletter[] = "B"; uchar topbootletter[] = "T"; uchar botboottype[] = "bottom boot sector";

In message 1194419961-21822-2-git-send-email-plagnioj@jcrosoft.com you wrote:
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
diff --git a/net/net.c b/net/net.c index cde2680..f3c70c5 100644 --- a/net/net.c +++ b/net/net.c @@ -598,7 +598,7 @@ void NetStartAgain (void) if (NetRestartWrap) { NetRestartWrap = 0; if (NetDevExists && !once) {
NetSetTimeout (10 * CFG_HZ, startAgainTimeout);
} else { NetState = NETLOOP_FAIL;NetSetTimeout ((ulong)10 * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler);
This doesn't look right to me.
Instead of "(ulong)10 * CFG_HZ" we should probably write "10UL * CFG_HZ"
And, why do we cast the first operand to "ulong" - and not the second one, or the second one, too, or the result?
Finally, this is not the only place where this construct is used:
-> grep -n CFG_HZ net/net.c 253: if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT * CFG_HZ) { 592: NetSetTimeout (10 * CFG_HZ, startAgainTimeout); 601: NetSetTimeout (10 * CFG_HZ, startAgainTimeout); 777: NetSetTimeout (10 * CFG_HZ, PingTimeout); 800:#define CDP_TIMEOUT (CFG_HZ/4) /* one packet every 250ms */
diff --git a/net/nfs.c b/net/nfs.c index 1b27c97..18b00cc 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -669,7 +669,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
case STATE_READ_REQ: rlen = nfs_read_reply (pkt, len);
NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout);
if (rlen > 0) { nfs_offset += rlen; NfsSend ();NetSetTimeout ((ulong)NFS_TIMEOUT * CFG_HZ, NfsTimeout);
@@ -758,7 +758,7 @@ NfsStart (void) printf ("\nLoad address: 0x%lx\n" "Loading: *\b", load_addr);
- NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout);
NetSetTimeout ((ulong)NFS_TIMEOUT * CFG_HZ, NfsTimeout); NetSetHandler (NfsHandler);
NfsTimeoutCount = 0;
The first two questions from above apply here, too.
Best regards,
Wolfgang Denk

diff --git a/net/bootp.c b/net/bootp.c index 55dcc81..89e30d2 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -33,7 +33,7 @@
#if defined(CONFIG_CMD_NET)
-#define TIMEOUT 5 /* Seconds before trying BOOTP again */ +#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else diff --git a/net/bootp.h b/net/bootp.h index ba9826e..320cc3b 100644 --- a/net/bootp.h +++ b/net/bootp.h @@ -88,7 +88,7 @@ typedef enum { INIT, #define DHCP_NAK 6 #define DHCP_RELEASE 7
-#define SELECT_TIMEOUT 3 /* Seconds to wait for offers */ +#define SELECT_TIMEOUT 3UL /* Seconds to wait for offers */
/**********************************************************************/
diff --git a/net/net.c b/net/net.c index cde2680..c719bc4 100644 --- a/net/net.c +++ b/net/net.c @@ -94,7 +94,7 @@
DECLARE_GLOBAL_DATA_PTR;
-#define ARP_TIMEOUT 5 /* Seconds before trying ARP again */ +#define ARP_TIMEOUT 5UL /* Seconds before trying ARP again */ #ifndef CONFIG_NET_RETRY_COUNT # define ARP_TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else @@ -589,7 +589,7 @@ void NetStartAgain (void) return; } #ifndef CONFIG_NET_MULTI - NetSetTimeout (10 * CFG_HZ, startAgainTimeout); + NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler); #else /* !CONFIG_NET_MULTI*/ eth_halt (); @@ -598,7 +598,7 @@ void NetStartAgain (void) if (NetRestartWrap) { NetRestartWrap = 0; if (NetDevExists && !once) { - NetSetTimeout (10 * CFG_HZ, startAgainTimeout); + NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler); } else { NetState = NETLOOP_FAIL; @@ -774,7 +774,7 @@ static void PingStart(void) #if defined(CONFIG_NET_MULTI) printf ("Using %s device\n", eth_get_name()); #endif /* CONFIG_NET_MULTI */ - NetSetTimeout (10 * CFG_HZ, PingTimeout); + NetSetTimeout (10UL * CFG_HZ, PingTimeout); NetSetHandler (PingHandler);
PingSend(); diff --git a/net/nfs.c b/net/nfs.c index 1b27c97..aa8d612 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -34,7 +34,7 @@ #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ -#define NFS_TIMEOUT 60 +#define NFS_TIMEOUT 60UL
static int fs_mounted = 0; static unsigned long rpc_id = 0; diff --git a/net/rarp.c b/net/rarp.c index 21dfa52..ecf38e4 100644 --- a/net/rarp.c +++ b/net/rarp.c @@ -31,7 +31,7 @@
#if defined(CONFIG_CMD_NET)
-#define TIMEOUT 5 /* Seconds before trying BOOTP again */ +#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else diff --git a/net/tftp.c b/net/tftp.c index 5ee7676..8b95bcf 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -15,7 +15,7 @@ #if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ -#define TIMEOUT 5 /* Seconds to timeout for a lost pkt */ +#define TIMEOUT 5UL /* Seconds to timeout for a lost pkt */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 10 /* # of timeouts before giving up */ #else

In message 1195295470-3706-1-git-send-email-plagnioj@jcrosoft.com you wrote:
diff --git a/net/bootp.c b/net/bootp.c
Applied, thanks.
Best regards,
Wolfgang Denk

Fix warning integer overflow in expressioni bootp.c, rarp.c and tftp.c Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
diff --git a/net/bootp.c b/net/bootp.c index 55dcc81..89e30d2 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -33,7 +33,7 @@
#if defined(CONFIG_CMD_NET)
-#define TIMEOUT 5 /* Seconds before trying BOOTP again */ +#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else diff --git a/net/bootp.h b/net/bootp.h index ba9826e..320cc3b 100644 --- a/net/bootp.h +++ b/net/bootp.h @@ -88,7 +88,7 @@ typedef enum { INIT, #define DHCP_NAK 6 #define DHCP_RELEASE 7
-#define SELECT_TIMEOUT 3 /* Seconds to wait for offers */ +#define SELECT_TIMEOUT 3UL /* Seconds to wait for offers */
/**********************************************************************/
diff --git a/net/net.c b/net/net.c index cde2680..c719bc4 100644 --- a/net/net.c +++ b/net/net.c @@ -94,7 +94,7 @@
DECLARE_GLOBAL_DATA_PTR;
-#define ARP_TIMEOUT 5 /* Seconds before trying ARP again */ +#define ARP_TIMEOUT 5UL /* Seconds before trying ARP again */ #ifndef CONFIG_NET_RETRY_COUNT # define ARP_TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else @@ -589,7 +589,7 @@ void NetStartAgain (void) return; } #ifndef CONFIG_NET_MULTI - NetSetTimeout (10 * CFG_HZ, startAgainTimeout); + NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler); #else /* !CONFIG_NET_MULTI*/ eth_halt (); @@ -598,7 +598,7 @@ void NetStartAgain (void) if (NetRestartWrap) { NetRestartWrap = 0; if (NetDevExists && !once) { - NetSetTimeout (10 * CFG_HZ, startAgainTimeout); + NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); NetSetHandler (startAgainHandler); } else { NetState = NETLOOP_FAIL; @@ -774,7 +774,7 @@ static void PingStart(void) #if defined(CONFIG_NET_MULTI) printf ("Using %s device\n", eth_get_name()); #endif /* CONFIG_NET_MULTI */ - NetSetTimeout (10 * CFG_HZ, PingTimeout); + NetSetTimeout (10UL * CFG_HZ, PingTimeout); NetSetHandler (PingHandler);
PingSend(); diff --git a/net/nfs.c b/net/nfs.c index 1b27c97..aa8d612 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -34,7 +34,7 @@ #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ -#define NFS_TIMEOUT 60 +#define NFS_TIMEOUT 60UL
static int fs_mounted = 0; static unsigned long rpc_id = 0; diff --git a/net/rarp.c b/net/rarp.c index 21dfa52..ecf38e4 100644 --- a/net/rarp.c +++ b/net/rarp.c @@ -31,7 +31,7 @@
#if defined(CONFIG_CMD_NET)
-#define TIMEOUT 5 /* Seconds before trying BOOTP again */ +#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else diff --git a/net/tftp.c b/net/tftp.c index 5ee7676..8b95bcf 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -15,7 +15,7 @@ #if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ -#define TIMEOUT 5 /* Seconds to timeout for a lost pkt */ +#define TIMEOUT 5UL /* Seconds to timeout for a lost pkt */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 10 /* # of timeouts before giving up */ #else

In message 1195295634-3804-1-git-send-email-plagnioj@jcrosoft.com you wrote:
Fix warning integer overflow in expressioni bootp.c, rarp.c and tftp.c Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
diff --git a/net/bootp.c b/net/bootp.c index 55dcc81..89e30d2 100644
Umm...
error: patch failed: net/bootp.c:33 error: net/bootp.c: patch does not apply error: patch failed: net/bootp.h:88 error: net/bootp.h: patch does not apply error: patch failed: net/net.c:94 error: net/net.c: patch does not apply error: patch failed: net/nfs.c:34 error: net/nfs.c: patch does not apply error: patch failed: net/rarp.c:31 error: net/rarp.c: patch does not apply error: patch failed: net/tftp.c:15 error: net/tftp.c: patch does not apply Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied.
Please check!!
Best regards,
Wolfgang Denk

Hi J
Please excuse my ignorance. Your patch is of course the right fix and I verified it on my ARM boards. A great thank you for providing the right fix and doing it so quickly.
Cheers
Marcel

Hi:
does anybody know any errata regarding at91rm9200 internal RTC? Somehow I can set it only once. After that ACKUPD bit remains ON forver and RTC calendar register cannot be modified.
Thanks,
Leonid.

In message 1194419961-21822-1-git-send-email-plagnioj@jcrosoft.com you wrote:
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
diff --git a/common/cmd_ide.c b/common/cmd_ide.c index bb064ea..27cecac 100644
Applied, thanks.
Best regards,
Wolfgang Denk
participants (4)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Leonid
-
Marcel Ziswiler
-
Wolfgang Denk