[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231109021308.1859881-1-nichen@iscas.ac.cn>
Date: Thu, 9 Nov 2023 02:13:08 +0000
From: Chen Ni <nichen@...as.ac.cn>
To: qianweili@...wei.com, wangzhou1@...ilicon.com,
herbert@...dor.apana.org.au, davem@...emloft.net,
xuzaibo@...wei.com, tanshukun1@...wei.com
Cc: linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
Chen Ni <nichen@...as.ac.cn>
Subject: [PATCH] crypto: hisilicon - Add check for pci_find_ext_capability
Add check for pci_find_ext_capability() and return the error if it
fails in order to transfer the error.
Fixes: 6c6dd5802c2d ("crypto: hisilicon/qm - add controller reset interface")
Signed-off-by: Chen Ni <nichen@...as.ac.cn>
---
drivers/crypto/hisilicon/qm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 18599f3634c3..adbab1286d4a 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -3967,6 +3967,9 @@ static int qm_set_vf_mse(struct hisi_qm *qm, bool set)
int i;
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
+ if (!pos)
+ return -ENODEV;
+
pci_read_config_word(pdev, pos + PCI_SRIOV_CTRL, &sriov_ctrl);
if (set)
sriov_ctrl |= PCI_SRIOV_CTRL_MSE;
--
2.25.1
Powered by blists - more mailing lists