]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: hisi_sas: Replace with standard error code return value
authorYihang Li <liyihang9@huawei.com>
Thu, 14 Dec 2023 03:45:13 +0000 (11:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 22:52:38 +0000 (14:52 -0800)
[ Upstream commit d34ee535705eb43885bc0f561c63046f697355ad ]

In function hisi_sas_controller_prereset(), -ENOSYS (Function not
implemented) should be returned if the driver does not support .soft_reset.
Returns -EPERM (Operation not permitted) if HISI_SAS_RESETTING_BIT is
already be set.

In function _suspend_v3_hw(), returns -EPERM (Operation not permitted) if
HISI_SAS_RESETTING_BIT is already be set.

Fixes: 4522204ab218 ("scsi: hisi_sas: tidy host controller reset function a bit")
Signed-off-by: Yihang Li <liyihang9@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1702525516-51258-3-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index 19081790f01181fdfd01b334213a414f5273da32..530f61df109a33a30722f7a97703e02ad56d2804 100644 (file)
@@ -1584,12 +1584,12 @@ EXPORT_SYMBOL_GPL(hisi_sas_controller_reset_done);
 static int hisi_sas_controller_prereset(struct hisi_hba *hisi_hba)
 {
        if (!hisi_hba->hw->soft_reset)
-               return -1;
+               return -ENOENT;
 
        down(&hisi_hba->sem);
        if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) {
                up(&hisi_hba->sem);
-               return -1;
+               return -EPERM;
        }
 
        if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct)
index 0e57381121d519681de439b604262d60abd0b842..88af529ab1004261f22e19f4790b86b08955f740 100644 (file)
@@ -4983,7 +4983,7 @@ static int _suspend_v3_hw(struct device *device)
        }
 
        if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags))
-               return -1;
+               return -EPERM;
 
        scsi_block_requests(shost);
        set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);