* [PATCH] crypto: hisilicon - Add check for pci_find_ext_capability
@ 2023-11-09 2:13 Chen Ni
2023-11-17 2:07 ` Weili Qian
0 siblings, 1 reply; 4+ messages in thread
From: Chen Ni @ 2023-11-09 2:13 UTC (permalink / raw)
To: qianweili, wangzhou1, herbert, davem, xuzaibo, tanshukun1
Cc: linux-crypto, linux-kernel, Chen Ni
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@iscas.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: hisilicon - Add check for pci_find_ext_capability
2023-11-09 2:13 [PATCH] crypto: hisilicon - Add check for pci_find_ext_capability Chen Ni
@ 2023-11-17 2:07 ` Weili Qian
2023-11-17 10:36 ` Herbert Xu
0 siblings, 1 reply; 4+ messages in thread
From: Weili Qian @ 2023-11-17 2:07 UTC (permalink / raw)
To: Chen Ni, wangzhou1, herbert, davem, xuzaibo, tanshukun1
Cc: linux-crypto, linux-kernel
On 2023/11/9 10:13, Chen Ni wrote:
> 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@iscas.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;
> +
Thanks for your patch. The function qm_set_vf_mse() is called only after SRIOV
is enabled, so function pci_find_ext_capability() does not return 0. This check
makes no sense.
Thanks,
Weili
> pci_read_config_word(pdev, pos + PCI_SRIOV_CTRL, &sriov_ctrl);
> if (set)
> sriov_ctrl |= PCI_SRIOV_CTRL_MSE;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: hisilicon - Add check for pci_find_ext_capability
2023-11-17 2:07 ` Weili Qian
@ 2023-11-17 10:36 ` Herbert Xu
2023-11-22 12:11 ` Weili Qian
0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2023-11-17 10:36 UTC (permalink / raw)
To: Weili Qian
Cc: Chen Ni, wangzhou1, davem, xuzaibo, tanshukun1, linux-crypto,
linux-kernel
On Fri, Nov 17, 2023 at 10:07:00AM +0800, Weili Qian wrote:
>
> Thanks for your patch. The function qm_set_vf_mse() is called only after SRIOV
> is enabled, so function pci_find_ext_capability() does not return 0. This check
> makes no sense.
Perhaps we could add a comment instead?
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: hisilicon - Add check for pci_find_ext_capability
2023-11-17 10:36 ` Herbert Xu
@ 2023-11-22 12:11 ` Weili Qian
0 siblings, 0 replies; 4+ messages in thread
From: Weili Qian @ 2023-11-22 12:11 UTC (permalink / raw)
To: Herbert Xu
Cc: Chen Ni, wangzhou1, davem, xuzaibo, tanshukun1, linux-crypto,
linux-kernel
On 2023/11/17 18:36, Herbert Xu wrote:
> On Fri, Nov 17, 2023 at 10:07:00AM +0800, Weili Qian wrote:
>>
>> Thanks for your patch. The function qm_set_vf_mse() is called only after SRIOV
>> is enabled, so function pci_find_ext_capability() does not return 0. This check
>> makes no sense.
>
> Perhaps we could add a comment instead?
>
> Thanks,
>
Okay, I will add a comment for this.
Thanks,
Weili
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-22 12:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 2:13 [PATCH] crypto: hisilicon - Add check for pci_find_ext_capability Chen Ni
2023-11-17 2:07 ` Weili Qian
2023-11-17 10:36 ` Herbert Xu
2023-11-22 12:11 ` Weili Qian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).