Commit 1d5827a12ebd20d64b972111b846cb1ca87ff82e

Authored by Simon Glass
1 parent 2e17c87ebb

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

common/usb_storage.c
... ... @@ -1191,6 +1191,7 @@
1191 1191 iface->desc.bInterfaceClass != USB_CLASS_MASS_STORAGE ||
1192 1192 iface->desc.bInterfaceSubClass < US_SC_MIN ||
1193 1193 iface->desc.bInterfaceSubClass > US_SC_MAX) {
  1194 + debug("Not mass storage\n");
1194 1195 /* if it's not a mass storage, we go no further */
1195 1196 return 0;
1196 1197 }
1197 1198  
... ... @@ -1317,8 +1318,10 @@
1317 1318 pccb->lun = dev_desc->lun;
1318 1319 debug(" address %d\n", dev_desc->target);
1319 1320  
1320   - if (usb_inquiry(pccb, ss))
  1321 + if (usb_inquiry(pccb, ss)) {
  1322 + debug("%s: usb_inquiry() failed\n", __func__);
1321 1323 return -1;
  1324 + }
1322 1325  
1323 1326 perq = usb_stor_buf[0];
1324 1327 modi = usb_stor_buf[1];
... ... @@ -1328,6 +1331,7 @@
1328 1331 * they would not respond to test_unit_ready .
1329 1332 */
1330 1333 if (((perq & 0x1f) == 0x1f) || ((perq & 0x1f) == 0x0d)) {
  1334 + debug("%s: unknown/unsupported device\n", __func__);
1331 1335 return 0;
1332 1336 }
1333 1337 if ((modi&0x80) == 0x80) {