@@ -1050,6 +1050,7 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
struct ata_eh_info *ehi = &link->eh_info;
unsigned long flags = 0;
int poll_next;
+ unsigned int task_state;
WARN_ON_ONCE((qc->flags & ATA_QCFLAG_ACTIVE) == 0);
@@ -1063,7 +1064,11 @@ fsm_start:
DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n",
ap->print_id, qc->tf.protocol, ap->hsm_task_state, status);
- switch (ap->hsm_task_state) {
+ spin_lock_irq(ap->lock);
+ task_state = ap->hsm_task_state;
+ spin_unlock_irq(ap->lock);
+
+ switch (task_state) {
case HSM_ST_FIRST:
/* Send first data block or PACKET CDB */