Commit a923f756 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] libsas: reindent sas_queuecommand

Switch sas_queuecommand to a normal indentation and goto based error handling.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 92bd401b
...@@ -184,19 +184,16 @@ int sas_queue_up(struct sas_task *task) ...@@ -184,19 +184,16 @@ int sas_queue_up(struct sas_task *task)
int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
{ {
int res = 0;
struct domain_device *dev = cmd_to_domain_dev(cmd);
struct sas_internal *i = to_sas_internal(host->transportt); struct sas_internal *i = to_sas_internal(host->transportt);
struct domain_device *dev = cmd_to_domain_dev(cmd);
{
struct sas_ha_struct *sas_ha = dev->port->ha; struct sas_ha_struct *sas_ha = dev->port->ha;
struct sas_task *task; struct sas_task *task;
int res = 0;
/* If the device fell off, no sense in issuing commands */ /* If the device fell off, no sense in issuing commands */
if (dev->gone) { if (dev->gone) {
cmd->result = DID_BAD_TARGET << 16; cmd->result = DID_BAD_TARGET << 16;
cmd->scsi_done(cmd); goto out_done;
goto out;
} }
if (dev_is_sata(dev)) { if (dev_is_sata(dev)) {
...@@ -205,13 +202,12 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) ...@@ -205,13 +202,12 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
spin_lock_irqsave(dev->sata_dev.ap->lock, flags); spin_lock_irqsave(dev->sata_dev.ap->lock, flags);
res = ata_sas_queuecmd(cmd, dev->sata_dev.ap); res = ata_sas_queuecmd(cmd, dev->sata_dev.ap);
spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags); spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags);
goto out; return res;
} }
res = -ENOMEM;
task = sas_create_task(cmd, dev, GFP_ATOMIC); task = sas_create_task(cmd, dev, GFP_ATOMIC);
if (!task) if (!task)
goto out; return -ENOMEM;
/* Queue up, Direct Mode or Task Collector Mode. */ /* Queue up, Direct Mode or Task Collector Mode. */
if (sas_ha->lldd_max_execute_num < 2) if (sas_ha->lldd_max_execute_num < 2)
...@@ -219,21 +215,20 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) ...@@ -219,21 +215,20 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
else else
res = sas_queue_up(task); res = sas_queue_up(task);
/* Examine */ if (res)
if (res) { goto out_free_task;
return 0;
out_free_task:
SAS_DPRINTK("lldd_execute_task returned: %d\n", res); SAS_DPRINTK("lldd_execute_task returned: %d\n", res);
ASSIGN_SAS_TASK(cmd, NULL); ASSIGN_SAS_TASK(cmd, NULL);
sas_free_task(task); sas_free_task(task);
if (res == -SAS_QUEUE_FULL) { if (res != -SAS_QUEUE_FULL)
return res;
cmd->result = DID_SOFT_ERROR << 16; /* retry */ cmd->result = DID_SOFT_ERROR << 16; /* retry */
res = 0; out_done:
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
} return 0;
goto out;
}
}
out:
return res;
} }
static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) static void sas_eh_finish_cmd(struct scsi_cmnd *cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment