]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: hisilicon/qm - add device status check when start fails
authorWeili Qian <qianweili@huawei.com>
Sat, 19 Nov 2022 09:50:03 +0000 (17:50 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 25 Nov 2022 09:39:19 +0000 (17:39 +0800)
In function 'hisi_qm_resume', if the device fails to be started,
directly returning error code will cause the device to be unavailable.
However, the failure may be caused by device error, which will be
reported to the driver, and driver can reset and restart device.
Therefore, check device status instead of returning error code
directly. Returns 0 if device error has occurred, otherwise returns
error code.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/qm.c

index 9072bee7336fe45a5552a6a231fae2800d4955d3..007ac7a69ce74759c2a973cf38c6d3894097b4b0 100644 (file)
@@ -5468,8 +5468,14 @@ int hisi_qm_resume(struct device *dev)
        }
 
        ret = hisi_qm_start(qm);
-       if (ret)
-               pci_err(pdev, "failed to start qm(%d)\n", ret);
+       if (ret) {
+               if (qm_check_dev_error(qm)) {
+                       pci_info(pdev, "failed to start qm due to device error, device will be reset!\n");
+                       return 0;
+               }
+
+               pci_err(pdev, "failed to start qm(%d)!\n", ret);
+       }
 
        return ret;
 }