OSDN Git Service

scsi: pm8001: Simplify pm8001_task_exec()
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Sun, 20 Feb 2022 03:18:07 +0000 (12:18 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Feb 2022 02:31:21 +0000 (21:31 -0500)
commite29c47fe8946cc732b0e0d393b65b13c84bb69d0
tree0f7ee0fc01b7151bb2c245cee943e125a78b59b0
parentf91767a35f0951ac30a6607497b3b9aa2b79d74e
scsi: pm8001: Simplify pm8001_task_exec()

The main part of the pm8001_task_exec() function uses a do {} while(0) loop
that is useless and only makes the code harder to read. Remove this
loop. The unnecessary local variable t is also removed.

Additionally, avoid repeatedly declaring "struct task_status_struct *ts" to
handle error cases by declaring this variable for the entire function
scope. This allows simplifying the error cases, and together with the
addition of blank lines make the code more readable.

Finally, handling of the running_req counter is fixed to avoid decrementing
it without a corresponding incrementation in the case of an invalid task
protocol.

Link: https://lore.kernel.org/r/20220220031810.738362-29-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/pm8001/pm8001_sas.c