Commit 57dbed85 authored by Weili Qian's avatar Weili Qian Committed by JiangShui
Browse files

crypto: hisilicon/qm - add device status check when start fails

mainline inclusion
from mainline-v6.2-rc1
commit 5f9c97a0
category: feature
bugzilla: https://gitee/com/openeuler/kernel/issues/16VW8E
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5f9c97a0e6dc873f662528ae591f2bd500eb5940



-------------------------------------------------------------------

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: default avatarWeili Qian <qianweili@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarJangShui <yangjiangshui@h-partners.com>
parent 9aef98ff
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -5474,8 +5474,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;
}