summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorWeili Qian <qianweili@huawei.com>2022-11-19 12:50:03 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2022-11-25 12:39:19 +0300
commit5f9c97a0e6dc873f662528ae591f2bd500eb5940 (patch)
treecce519c07102f434694f24c601fc6e22c0187f87 /drivers/crypto
parent3901355624d14afe3230252cb36bc3da8ff6890e (diff)
downloadlinux-5f9c97a0e6dc873f662528ae591f2bd500eb5940.tar.xz
crypto: hisilicon/qm - add device status check when start fails
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>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/hisilicon/qm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 9072bee7336f..007ac7a69ce7 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -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;
}