mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 22:50:41 +00:00
scsi: pm8001: Cleanup pm8001_exec_internal_task_abort()
Replace the goto statement in the for loop with "break" and remove the ex_err label. Also fix long lines, identation and blank lines to make the code more readable. Link: https://lore.kernel.org/r/20220220031810.738362-25-damien.lemoal@opensource.wdc.com Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
a1e7c79919
commit
0c4ad6c3d3
@ -724,50 +724,54 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
|
|||||||
task->task_proto = dev->tproto;
|
task->task_proto = dev->tproto;
|
||||||
task->task_done = pm8001_task_done;
|
task->task_done = pm8001_task_done;
|
||||||
task->slow_task->timer.function = pm8001_tmf_timedout;
|
task->slow_task->timer.function = pm8001_tmf_timedout;
|
||||||
task->slow_task->timer.expires = jiffies + PM8001_TASK_TIMEOUT * HZ;
|
task->slow_task->timer.expires =
|
||||||
|
jiffies + PM8001_TASK_TIMEOUT * HZ;
|
||||||
add_timer(&task->slow_task->timer);
|
add_timer(&task->slow_task->timer);
|
||||||
|
|
||||||
res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
|
res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
|
||||||
if (res)
|
if (res)
|
||||||
goto ex_err;
|
break;
|
||||||
|
|
||||||
ccb = &pm8001_ha->ccb_info[ccb_tag];
|
ccb = &pm8001_ha->ccb_info[ccb_tag];
|
||||||
ccb->device = pm8001_dev;
|
ccb->device = pm8001_dev;
|
||||||
ccb->ccb_tag = ccb_tag;
|
ccb->ccb_tag = ccb_tag;
|
||||||
ccb->task = task;
|
ccb->task = task;
|
||||||
ccb->n_elem = 0;
|
ccb->n_elem = 0;
|
||||||
|
|
||||||
res = PM8001_CHIP_DISP->task_abort(pm8001_ha,
|
res = PM8001_CHIP_DISP->task_abort(pm8001_ha, pm8001_dev, flag,
|
||||||
pm8001_dev, flag, task_tag, ccb_tag);
|
task_tag, ccb_tag);
|
||||||
if (res) {
|
if (res) {
|
||||||
del_timer(&task->slow_task->timer);
|
del_timer(&task->slow_task->timer);
|
||||||
pm8001_dbg(pm8001_ha, FAIL, "Executing internal task failed\n");
|
pm8001_dbg(pm8001_ha, FAIL,
|
||||||
|
"Executing internal task failed\n");
|
||||||
pm8001_tag_free(pm8001_ha, ccb_tag);
|
pm8001_tag_free(pm8001_ha, ccb_tag);
|
||||||
goto ex_err;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for_completion(&task->slow_task->completion);
|
wait_for_completion(&task->slow_task->completion);
|
||||||
res = TMF_RESP_FUNC_FAILED;
|
res = TMF_RESP_FUNC_FAILED;
|
||||||
|
|
||||||
/* Even TMF timed out, return direct. */
|
/* Even TMF timed out, return direct. */
|
||||||
if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
|
if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
|
||||||
pm8001_dbg(pm8001_ha, FAIL, "TMF task timeout.\n");
|
pm8001_dbg(pm8001_ha, FAIL, "TMF task timeout.\n");
|
||||||
goto ex_err;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (task->task_status.resp == SAS_TASK_COMPLETE &&
|
if (task->task_status.resp == SAS_TASK_COMPLETE &&
|
||||||
task->task_status.stat == SAS_SAM_STAT_GOOD) {
|
task->task_status.stat == SAS_SAM_STAT_GOOD) {
|
||||||
res = TMF_RESP_FUNC_COMPLETE;
|
res = TMF_RESP_FUNC_COMPLETE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else {
|
|
||||||
pm8001_dbg(pm8001_ha, EH,
|
|
||||||
" Task to dev %016llx response: 0x%x status 0x%x\n",
|
|
||||||
SAS_ADDR(dev->sas_addr),
|
|
||||||
task->task_status.resp,
|
|
||||||
task->task_status.stat);
|
|
||||||
sas_free_task(task);
|
|
||||||
task = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pm8001_dbg(pm8001_ha, EH,
|
||||||
|
" Task to dev %016llx response: 0x%x status 0x%x\n",
|
||||||
|
SAS_ADDR(dev->sas_addr),
|
||||||
|
task->task_status.resp,
|
||||||
|
task->task_status.stat);
|
||||||
|
sas_free_task(task);
|
||||||
|
task = NULL;
|
||||||
}
|
}
|
||||||
ex_err:
|
|
||||||
BUG_ON(retry == 3 && task != NULL);
|
BUG_ON(retry == 3 && task != NULL);
|
||||||
sas_free_task(task);
|
sas_free_task(task);
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user