Skip to contentSkip to conversation

driver: usb: Fix pointer conversion warnings for hikey

PATCH New Prabhakar Kushwaha 2 participants 2 messages Oct 25, 2015 – Nov 13, 2015 USB

lore
Share & tools
lore
#0 lore raw

PATCH 3/5 driver: usb: Fix pointer conversion warnings for hikey

Fix below compilation warings happening for hikey_defconfig

drivers/usb/eth/smsc95xx.c:698:56: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

  debug("** %s(), len %d, buf %#x\n", __func__, length, (int)msg);
                                                        ^
include/common.h:109:26: note: in definition of macro ?debug_cond?
    printf(pr_fmt(fmt), ##args); \
                          ^

drivers/usb/eth/smsc95xx.c:698:2: note: in expansion of macro ?debug?
debug("** %s(), len %d, buf %#x\n", __func__, length, (int)msg); ^
drivers/usb/eth/smsc95xx.c:718:2: warning: format ?%u? expects argument of type ?unsigned int?, but argument 2 has type ?long unsigned int? [-Wformat=]
debug("Tx: len = %u, actual = %u, err = %d\n",
^
drivers/usb/eth/smsc95xx.c: In function ?smsc95xx_recv?:
drivers/usb/eth/smsc95xx.c:802:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

   cur_buf_align = (int)buf_ptr - (int)recv_buf;
                   ^

drivers/usb/eth/smsc95xx.c:802:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
cur_buf_align = (int)buf_ptr - (int)recv_buf;

---
 drivers/usb/eth/smsc95xx.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/eth/smsc95xx.c +5 -4
index dc8fa88..378aed4 100644
@@ -695,7 +695,8 @@ static int smsc95xx_send_common(struct ueth_data *dev, void *packet, int length)
 	ALLOC_CACHE_ALIGN_BUFFER(unsigned char, msg,
 				 PKTSIZE + sizeof(tx_cmd_a) + sizeof(tx_cmd_b));
 
-	debug("** %s(), len %d, buf %#x\n", __func__, length, (int)msg);
+	debug("** %s(), len %d, buf %#x\n", __func__, length,
+	      (unsigned int)(ulong)msg);
 	if (length > PKTSIZE)
 		return -ENOSPC;
 
@@ -716,8 +717,8 @@ static int smsc95xx_send_common(struct ueth_data *dev, void *packet, int length)
 				&actual_len,
 				USB_BULK_SEND_TIMEOUT);
 	debug("Tx: len = %u, actual = %u, err = %d\n",
-	      length + sizeof(tx_cmd_a) + sizeof(tx_cmd_b),
-	      actual_len, err);
+	      (unsigned int)(length + sizeof(tx_cmd_a) + sizeof(tx_cmd_b)),
+	      (unsigned int)actual_len, err);
 
 	return err;
 }
@@ -799,7 +800,7 @@ static int smsc95xx_recv(struct eth_device *eth)
 		/* Adjust for next iteration */
 		actual_len -= sizeof(packet_len) + packet_len;
 		buf_ptr += sizeof(packet_len) + packet_len;
-		cur_buf_align = (int)buf_ptr - (int)recv_buf;
+		cur_buf_align = (ulong)buf_ptr - (ulong)recv_buf;
 
 		if (cur_buf_align & 0x03) {
 			int align = 4 - (cur_buf_align & 0x03);
Signature · 1 line
1.9.1
#1 lore raw

PATCH 3/5 driver: usb: Fix pointer conversion warnings for hikey

Quoted 19 lines · Prabhakar Kushwaha

Fix below compilation warings happening for hikey_defconfig

drivers/usb/eth/smsc95xx.c:698:56: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

  debug("** %s(), len %d, buf %#x\n", __func__, length, (int)msg);
                                                        ^
include/common.h:109:26: note: in definition of macro ?debug_cond?
    printf(pr_fmt(fmt), ##args); \
                          ^

drivers/usb/eth/smsc95xx.c:698:2: note: in expansion of macro ?debug?
debug("** %s(), len %d, buf %#x\n", __func__, length, (int)msg); ^
drivers/usb/eth/smsc95xx.c:718:2: warning: format ?%u? expects argument of type ?unsigned int?, but argument 2 has type ?long unsigned int? [-Wformat=]
debug("Tx: len = %u, actual = %u, err = %d\n",
^
drivers/usb/eth/smsc95xx.c: In function ?smsc95xx_recv?:
drivers/usb/eth/smsc95xx.c:802:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Quoted 7 lines
   cur_buf_align = (int)buf_ptr - (int)recv_buf;
                   ^

drivers/usb/eth/smsc95xx.c:802:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
cur_buf_align = (int)buf_ptr - (int)recv_buf;

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151112/170d91a9/attachment.sig>