Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi...
[sfrench/cifs-2.6.git] / drivers / scsi / hpsa.c
index 148663373f7d31961e471f594d2dcd342df7e5e9..216e557f703e6c0b466fc29dddc05364b3127bf2 100644 (file)
@@ -2333,6 +2333,8 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,
        case IOACCEL2_SERV_RESPONSE_COMPLETE:
                switch (c2->error_data.status) {
                case IOACCEL2_STATUS_SR_TASK_COMP_GOOD:
+                       if (cmd)
+                               cmd->result = 0;
                        break;
                case IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND:
                        cmd->result |= SAM_STAT_CHECK_CONDITION;
@@ -2482,8 +2484,10 @@ static void process_ioaccel2_completion(struct ctlr_info *h,
 
        /* check for good status */
        if (likely(c2->error_data.serv_response == 0 &&
-                       c2->error_data.status == 0))
+                       c2->error_data.status == 0)) {
+               cmd->result = 0;
                return hpsa_cmd_free_and_done(h, c, cmd);
+       }
 
        /*
         * Any RAID offload error results in retry which will use
@@ -5473,6 +5477,8 @@ static int hpsa_ciss_submit(struct ctlr_info *h,
                return SCSI_MLQUEUE_HOST_BUSY;
        }
 
+       c->device = dev;
+
        enqueue_cmd_and_start_io(h, c);
        /* the cmd'll come back via intr handler in complete_scsi_command()  */
        return 0;
@@ -5544,6 +5550,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h,
                hpsa_cmd_init(h, c->cmdindex, c);
                c->cmd_type = CMD_SCSI;
                c->scsi_cmd = cmd;
+               c->device = dev;
                rc = hpsa_scsi_ioaccel_raid_map(h, c);
                if (rc < 0)     /* scsi_dma_map failed. */
                        rc = SCSI_MLQUEUE_HOST_BUSY;
@@ -5551,6 +5558,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h,
                hpsa_cmd_init(h, c->cmdindex, c);
                c->cmd_type = CMD_SCSI;
                c->scsi_cmd = cmd;
+               c->device = dev;
                rc = hpsa_scsi_ioaccel_direct_map(h, c);
                if (rc < 0)     /* scsi_dma_map failed. */
                        rc = SCSI_MLQUEUE_HOST_BUSY;
@@ -5652,6 +5660,12 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
        if (c == NULL)
                return SCSI_MLQUEUE_DEVICE_BUSY;
 
+       /*
+        * This is necessary because the SML doesn't zero out this field during
+        * error recovery.
+        */
+       cmd->result = 0;
+
        /*
         * Call alternate submit routine for I/O accelerated commands.
         * Retries always go down the normal I/O path.
@@ -6080,8 +6094,6 @@ static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h,
                if (idx != h->last_collision_tag) { /* Print once per tag */
                        dev_warn(&h->pdev->dev,
                                "%s: tag collision (tag=%d)\n", __func__, idx);
-                       if (c->scsi_cmd != NULL)
-                               scsi_print_command(c->scsi_cmd);
                        if (scmd)
                                scsi_print_command(scmd);
                        h->last_collision_tag = idx;
@@ -7797,7 +7809,7 @@ static void hpsa_free_pci_init(struct ctlr_info *h)
        hpsa_disable_interrupt_mode(h);         /* pci_init 2 */
        /*
         * call pci_disable_device before pci_release_regions per
-        * Documentation/PCI/pci.rst
+        * Documentation/driver-api/pci/pci.rst
         */
        pci_disable_device(h->pdev);            /* pci_init 1 */
        pci_release_regions(h->pdev);           /* pci_init 2 */
@@ -7880,7 +7892,7 @@ clean2:   /* intmode+region, pci */
 clean1:
        /*
         * call pci_disable_device before pci_release_regions per
-        * Documentation/PCI/pci.rst
+        * Documentation/driver-api/pci/pci.rst
         */
        pci_disable_device(h->pdev);
        pci_release_regions(h->pdev);