Message ID | 20240605031835.2916052-1-nichen@iscas.ac.cn (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Herbert Xu |
Headers | show |
Series | crypto: qat - add check for adf_cfg_add_key_value_param | expand |
On Wed, Jun 05, 2024 at 11:18:35AM +0800, Chen Ni wrote: > Add check for the return value of adf_cfg_add_key_value_param() and > return the error if it fails in order to catch the error. > > Fixes: 4469f9b23468 ("crypto: qat - re-enable sriov after pf reset") > Signed-off-by: Chen Ni <nichen@iscas.ac.cn> > --- > drivers/crypto/intel/qat/qat_common/adf_sriov.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/crypto/intel/qat/qat_common/adf_sriov.c b/drivers/crypto/intel/qat/qat_common/adf_sriov.c > index 8d645e7e04aa..30ff9097f527 100644 > --- a/drivers/crypto/intel/qat/qat_common/adf_sriov.c > +++ b/drivers/crypto/intel/qat/qat_common/adf_sriov.c > @@ -228,8 +228,10 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs) > return ret; > > val = 1; > - adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED, > + ret = adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED, > &val, ADF_DEC); > + if (ret) > + return ret; This has the side effect of failing the enablement of VFs for QAT GEN2 as ADF_GENERAL_SEC is not present. For GEN4, where ADF_GENERAL_SEC is used, if this function fails, the recovery paths is not going to re-enable SRIOV VFs after reset. It is ok to omit this check. Regards,
diff --git a/drivers/crypto/intel/qat/qat_common/adf_sriov.c b/drivers/crypto/intel/qat/qat_common/adf_sriov.c index 8d645e7e04aa..30ff9097f527 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_sriov.c +++ b/drivers/crypto/intel/qat/qat_common/adf_sriov.c @@ -228,8 +228,10 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs) return ret; val = 1; - adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED, + ret = adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC, ADF_SRIOV_ENABLED, &val, ADF_DEC); + if (ret) + return ret; return numvfs; }
Add check for the return value of adf_cfg_add_key_value_param() and return the error if it fails in order to catch the error. Fixes: 4469f9b23468 ("crypto: qat - re-enable sriov after pf reset") Signed-off-by: Chen Ni <nichen@iscas.ac.cn> --- drivers/crypto/intel/qat/qat_common/adf_sriov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)