Fixup the inialization of qc->n_elem. It currently gets initialized to 1 for commands that do not transfer any data. Fix this by initializing n_elem to 0 and only setting to 1 in ata_scsi_qc_new when there is data to transfer. This fixes some problems seen with SATA devices attached to ipr adapters. Signed-off-by: Brian King <brking@xxxxxxxxxxxxxxxxxx> --- linux-2.6-bjking1/drivers/ata/libata-scsi.c | 2 +- linux-2.6-bjking1/include/linux/libata.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff -puN drivers/ata/libata-scsi.c~libata_fixup_nelem drivers/ata/libata-scsi.c --- linux-2.6/drivers/ata/libata-scsi.c~libata_fixup_nelem 2007-01-17 08:35:27.000000000 -0600 +++ linux-2.6-bjking1/drivers/ata/libata-scsi.c 2007-01-17 08:35:27.000000000 -0600 @@ -372,7 +372,7 @@ struct ata_queued_cmd *ata_scsi_qc_new(s if (cmd->use_sg) { qc->__sg = (struct scatterlist *) cmd->request_buffer; qc->n_elem = cmd->use_sg; - } else { + } else if (cmd->request_bufflen) { qc->__sg = &qc->sgent; qc->n_elem = 1; } diff -puN include/linux/libata.h~libata_fixup_nelem include/linux/libata.h --- linux-2.6/include/linux/libata.h~libata_fixup_nelem 2007-01-17 08:35:27.000000000 -0600 +++ linux-2.6-bjking1/include/linux/libata.h 2007-01-17 11:12:49.000000000 -0600 @@ -1149,6 +1149,7 @@ static inline void ata_qc_reinit(struct qc->cursect = qc->cursg = qc->cursg_ofs = 0; qc->nsect = 0; qc->nbytes = qc->curbytes = 0; + qc->n_elem = 0; qc->err_mask = 0; ata_tf_init(qc->dev, &qc->tf); _ - To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html