aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Lee <albertcc@tw.ibm.com>2007-12-05 02:43:02 -0500
committerJeff Garzik <jeff@garzik.org>2008-01-23 05:24:13 -0500
commit0106372db6dc135f300035ce8e93cddd7283a26a (patch)
tree951eb0c3567cad2bccf7dc3804bbdee0c462f291
parent93f8fecbe72bc3c121f3605dd198ff39ef358522 (diff)
libata: zero xfer length on ATAPI data xfer IRQ is HSM violation
Treat zero xfer length as HSM violation. While at it, add unlikely()'s to ATAPI ireason and transfer length checks. tj: Formatted patch and added unlikely()'s. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/ata/libata-core.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2b57547bd740..c9e6bd4d0686 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5309,12 +5309,15 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
5309 bytes = (bc_hi << 8) | bc_lo; 5309 bytes = (bc_hi << 8) | bc_lo;
5310 5310
5311 /* shall be cleared to zero, indicating xfer of data */ 5311 /* shall be cleared to zero, indicating xfer of data */
5312 if (ireason & (1 << 0)) 5312 if (unlikely(ireason & (1 << 0)))
5313 goto err_out; 5313 goto err_out;
5314 5314
5315 /* make sure transfer direction matches expected */ 5315 /* make sure transfer direction matches expected */
5316 i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0; 5316 i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0;
5317 if (do_write != i_write) 5317 if (unlikely(do_write != i_write))
5318 goto err_out;
5319
5320 if (unlikely(!bytes))
5318 goto err_out; 5321 goto err_out;
5319 5322
5320 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes); 5323 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);