aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-02-22 17:00:06 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-03-04 17:57:43 -0500
commit6d512a80c26d87f8599057c86dc920fbfe0aa3aa (patch)
tree17971e61a77fa4843a14e0c3cef047bf07b491bd /drivers/usb/storage
parent0ed930bffab2ec98ee8f43f579a30755c13dd5ea (diff)
usb-storage: update earlier scatter-gather bug fix
This patch (as1037) makes a small update to the earlier as1035 patch. The minimum-length computation shouldn't be done in usb_stor_access_xfer_buf(), since that routine can be called multiple times for a single transfer. It should be done in usb_stor_set_xfer_buf() instead, which gets called only once. The way it is now isn't really _wrong_, but it isn't really _right_ either. Moving the statement will be an improvement. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/protocol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index 958f5b17847c..b9b8ede61fb3 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -170,7 +170,6 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
170 170
171 if (!sg) 171 if (!sg)
172 sg = scsi_sglist(srb); 172 sg = scsi_sglist(srb);
173 buflen = min(buflen, scsi_bufflen(srb));
174 173
175 /* This loop handles a single s-g list entry, which may 174 /* This loop handles a single s-g list entry, which may
176 * include multiple pages. Find the initial page structure 175 * include multiple pages. Find the initial page structure
@@ -232,6 +231,7 @@ void usb_stor_set_xfer_buf(unsigned char *buffer,
232 unsigned int offset = 0; 231 unsigned int offset = 0;
233 struct scatterlist *sg = NULL; 232 struct scatterlist *sg = NULL;
234 233
234 buflen = min(buflen, scsi_bufflen(srb));
235 buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset, 235 buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
236 TO_XFER_BUF); 236 TO_XFER_BUF);
237 if (buflen < scsi_bufflen(srb)) 237 if (buflen < scsi_bufflen(srb))