megaraid_sas: Code optimization build_and_issue_cmd return-type
authorSumit Saxena <sumit.saxena@avagotech.com>
Thu, 28 Jan 2016 15:34:29 +0000 (21:04 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 24 Feb 2016 02:27:02 +0000 (21:27 -0500)
build_and_issue_cmd should return SCSI_MLQUEUE_HOST_BUSY for a few error
cases instead of returning 1.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c

index 8df58c2b08ecc549c99f10dbbba72e01ce264cce..edf8911bdb125b103075ddcf77ad5c91b25e7018 100644 (file)
@@ -1636,7 +1636,7 @@ megasas_build_and_issue_cmd(struct megasas_instance *instance,
        return 0;
 out_return_cmd:
        megasas_return_cmd(instance, cmd);
-       return 1;
+       return SCSI_MLQUEUE_HOST_BUSY;
 }
 
 
@@ -1728,12 +1728,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
                break;
        }
 
-       if (instance->instancet->build_and_issue_cmd(instance, scmd)) {
-               dev_err(&instance->pdev->dev, "Err returned from build_and_issue_cmd\n");
-               return SCSI_MLQUEUE_HOST_BUSY;
-       }
-
-       return 0;
+       return instance->instancet->build_and_issue_cmd(instance, scmd);
 
  out_done:
        scmd->scsi_done(scmd);
index 1351cae6acffb65eb0bd8d4c5c7ab9349ca14be9..f5538303a9bc484d9afa46c26b64712c0c92390c 100644 (file)
@@ -2125,7 +2125,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
 
        req_desc = megasas_get_request_descriptor(instance, index-1);
        if (!req_desc)
-               return 1;
+               return SCSI_MLQUEUE_HOST_BUSY;
 
        req_desc->Words = 0;
        cmd->request_desc = req_desc;
@@ -2134,7 +2134,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
                megasas_return_cmd_fusion(instance, cmd);
                dev_err(&instance->pdev->dev, "Error building command\n");
                cmd->request_desc = NULL;
-               return 1;
+               return SCSI_MLQUEUE_HOST_BUSY;
        }
 
        req_desc = cmd->request_desc;