summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-03-07 00:00:13 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-11 08:11:18 +0100
commit5240aa6fcb21846aadd5bb98dfd2eb0e69e1cf09 (patch)
tree4b826b90c24f3771fa0eef8a1aab0f1aecd050d6 /drivers/usb
parentc26391d125eef9d5b97356255c86ac802e943f7b (diff)
downloadbarebox-5240aa6fcb21846aadd5bb98dfd2eb0e69e1cf09.tar.gz
barebox-5240aa6fcb21846aadd5bb98dfd2eb0e69e1cf09.tar.xz
usb: storage: Don't use "unsigned long" for 32-bit values
Unsignled long will expand to 64-bit unsigned integer on 64-bit CPUs. This will break current code using it to read out two 32-bit values returned by READ_CAPACITY. Fix the proble by using "u32" explicitly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/storage/usb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 89a80c4839..db839e39a2 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -322,7 +322,7 @@ static int usb_stor_init_blkdev(struct us_blk_dev *pblk_dev)
struct us_data *us = pblk_dev->us;
struct device_d *dev = &us->pusb_dev->dev;
ccb us_ccb;
- unsigned long *pcap;
+ u32 *pcap;
int result = 0;
us_ccb.pdata = us_io_buf;
@@ -363,8 +363,8 @@ static int usb_stor_init_blkdev(struct us_blk_dev *pblk_dev)
result = -EIO;
goto Exit;
}
- pcap = (unsigned long *)us_ccb.pdata;
- dev_dbg(dev, "Read Capacity returns: 0x%lx, 0x%lx\n", pcap[0], pcap[1]);
+ pcap = (u32 *)us_ccb.pdata;
+ dev_dbg(dev, "Read Capacity returns: 0x%x, 0x%x\n", pcap[0], pcap[1]);
pblk_dev->blk.num_blocks = usb_limit_blk_cnt(be32_to_cpu(pcap[0]) + 1);
if (be32_to_cpu(pcap[1]) != SECTOR_SIZE)
pr_warn("Support only %d bytes sectors\n", SECTOR_SIZE);