]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: libsas: Check SMP PHY control function result
authorJohn Garry <john.garry@huawei.com>
Fri, 4 Jan 2019 16:01:27 +0000 (00:01 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 12 Jan 2019 03:14:24 +0000 (22:14 -0500)
Currently the SMP PHY control execution result is checked, however the
function result for the command is not.

As such, we may be missing all potential errors, like SMP FUNCTION FAILED,
INVALID REQUEST FRAME LENGTH, etc., meaning the PHY control request has
failed.

In some scenarios we need to ensure the function result is accepted, so add
a check for this.

Tested-by: Jian Luo <luojian5@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libsas/sas_expander.c

index 17eb4185f29de5b65a78ba3c344304666b5663e0..8817b8e6e507917fcb6ce5bed0d73b689d7bfd8d 100644 (file)
@@ -614,7 +614,14 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id,
        }
 
        res = smp_execute_task(dev, pc_req, PC_REQ_SIZE, pc_resp,PC_RESP_SIZE);
-
+       if (res) {
+               pr_err("ex %016llx phy%02d PHY control failed: %d\n",
+                      SAS_ADDR(dev->sas_addr), phy_id, res);
+       } else if (pc_resp[2] != SMP_RESP_FUNC_ACC) {
+               pr_err("ex %016llx phy%02d PHY control failed: function result 0x%x\n",
+                      SAS_ADDR(dev->sas_addr), phy_id, pc_resp[2]);
+               res = pc_resp[2];
+       }
        kfree(pc_resp);
        kfree(pc_req);
        return res;