summaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/usb.c
diff options
context:
space:
mode:
authorRobert Karszniewicz <r.karszniewicz@phytec.de>2019-10-25 17:56:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-11-04 10:41:30 +0100
commit31227a94238830a16767d207e0668015d297e9fa (patch)
tree869264cfbd3f1866b7ecb89c4603893aecc6d7aa /drivers/usb/storage/usb.c
parentcd6b02211852fa753b6a527af227aafd9d5088d4 (diff)
downloadbarebox-31227a94238830a16767d207e0668015d297e9fa.tar.gz
usb: storage: Increase retries for usb_stor_transport()
This should make writing and reading more reliable. Also: - change loop condition to make "retries" semantically correct - add a debug message in case of fatal failure Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r--drivers/usb/storage/usb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 63d624e..e0ef4f5 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -87,8 +87,7 @@ static int usb_stor_transport(struct us_blk_dev *usb_blkdev,
struct device_d *dev = &us->pusb_dev->dev;
int i, ret;
-
- for (i = 0; i < retries; i++) {
+ for (i = 0; i <= retries; i++) {
dev_dbg(dev, "%s\n", usb_stor_opcode_name(cmd[0]));
ret = us->transport(usb_blkdev, cmd, cmdlen, data, datalen);
dev_dbg(dev, "%s returns %d\n", usb_stor_opcode_name(cmd[0]),
@@ -105,6 +104,8 @@ static int usb_stor_transport(struct us_blk_dev *usb_blkdev,
mdelay(request_sense_delay_ms);
}
+ dev_dbg(dev, "Retried %s %d times, and failed.\n", usb_stor_opcode_name(cmd[0]), retries);
+
return -EIO;
}
@@ -194,7 +195,7 @@ static int usb_stor_io_10(struct us_blk_dev *usb_blkdev, u8 opcode,
put_unaligned_be16(blocks, &cmd[7]);
return usb_stor_transport(usb_blkdev, cmd, sizeof(cmd), data,
- blocks * SECTOR_SIZE, 2, 0);
+ blocks * SECTOR_SIZE, 10, 0);
}
/***********************************************************************