crypto: hisilicon/zip - fix the uninitalized 'curr_qm_qp_num'
[linux-2.6-microblaze.git] / drivers / scsi / mesh.c
index f9f8f49..fd1d030 100644 (file)
@@ -1045,6 +1045,8 @@ static void handle_error(struct mesh_state *ms)
                while ((in_8(&mr->bus_status1) & BS1_RST) != 0)
                        udelay(1);
                printk("done\n");
+               if (ms->dma_started)
+                       halt_dma(ms);
                handle_reset(ms);
                /* request_q is empty, no point in mesh_start() */
                return;
@@ -1357,7 +1359,8 @@ static void halt_dma(struct mesh_state *ms)
                       ms->conn_tgt, ms->data_ptr, scsi_bufflen(cmd),
                       ms->tgts[ms->conn_tgt].data_goes_out);
        }
-       scsi_dma_unmap(cmd);
+       if (cmd)
+               scsi_dma_unmap(cmd);
        ms->dma_started = 0;
 }
 
@@ -1712,6 +1715,9 @@ static int mesh_host_reset(struct scsi_cmnd *cmd)
 
        spin_lock_irqsave(ms->host->host_lock, flags);
 
+       if (ms->dma_started)
+               halt_dma(ms);
+
        /* Reset the controller & dbdma channel */
        out_le32(&md->control, (RUN|PAUSE|FLUSH|WAKE) << 16);   /* stop dma */
        out_8(&mr->exception, 0xff);    /* clear all exception bits */