crypto: qat - fix warnings reported by clang
Subsystems (2)
cover crypto: qat - fix warnings reported by clang
This set fixes a list of warnings found by compiling the QAT driver with "CC=clang W=2" and with the Clang tool scan-build.
These fixes include removing unused macros in both adf_cnv_dbgfs.c and qat_comp_alg.c, fix initialization of multiple variables, check that delta_us is not 0, and fixing the comment structures in multiple files.
Adam Guerin (6):
crypto: qat - remove unused macros in qat_comp_alg.c
crypto: qat - removed unused macro in adf_cnv_dbgfs.c
crypto: qat - avoid division by zero
crypto: qat - remove double initialization of value
crypto: qat - remove unnecessary description from comment
crypto: qat - fix comment structure
drivers/crypto/intel/qat/qat_common/adf_clock.c | 3 +++ drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c | 1 - drivers/crypto/intel/qat/qat_common/adf_dev_mgr.c | 4 ++-- drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c | 6 ++---- drivers/crypto/intel/qat/qat_common/adf_isr.c | 2 -- drivers/crypto/intel/qat/qat_common/adf_vf_isr.c | 2 -- drivers/crypto/intel/qat/qat_common/qat_comp_algs.c | 9 --------- drivers/crypto/intel/qat/qat_common/qat_crypto.c | 4 ++-- 8 files changed, 9 insertions(+), 22 deletions(-)
base-commit: 7a35f3adf4535a9a56ef7b3e75355806632030ca
Signature · 1 line
2.40.1
PATCH 1/6 crypto: qat - remove unused macros in qat_comp_alg.c
As a result of the removal of qat_zlib_deflate, some defines where not removed. Remove them.
This is to fix the following warning when compiling the QAT driver
using the clang compiler with CC=clang W=2:
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:21:9: warning: macro is not used [-Wunused-macros]
21 | #define QAT_RFC_1950_CM_OFFSET 4
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:16:9: warning: macro is not used [-Wunused-macros]
16 | #define QAT_RFC_1950_HDR_SIZE 2
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:17:9: warning: macro is not used [-Wunused-macros]
17 | #define QAT_RFC_1950_FOOTER_SIZE 4
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:22:9: warning: macro is not used [-Wunused-macros]
22 | #define QAT_RFC_1950_DICT_MASK 0x20
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:18:9: warning: macro is not used [-Wunused-macros]
18 | #define QAT_RFC_1950_CM_DEFLATE 8
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:20:9: warning: macro is not used [-Wunused-macros]
20 | #define QAT_RFC_1950_CM_MASK 0x0f
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:23:9: warning: macro is not used [-Wunused-macros]
23 | #define QAT_RFC_1950_COMP_HDR 0x785e
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:19:9: warning: macro is not used [-Wunused-macros]
19 | #define QAT_RFC_1950_CM_DEFLATE_CINFO_32K 7
| ^
--- drivers/crypto/intel/qat/qat_common/qat_comp_algs.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +0 -9
@@ -13,15 +13,6 @@#include "qat_compression.h" #include "qat_algs_send.h" -#define QAT_RFC_1950_HDR_SIZE 2 -#define QAT_RFC_1950_FOOTER_SIZE 4 -#define QAT_RFC_1950_CM_DEFLATE 8 -#define QAT_RFC_1950_CM_DEFLATE_CINFO_32K 7 -#define QAT_RFC_1950_CM_MASK 0x0f -#define QAT_RFC_1950_CM_OFFSET 4 -#define QAT_RFC_1950_DICT_MASK 0x20 -#define QAT_RFC_1950_COMP_HDR 0x785e -static DEFINE_MUTEX (algs_lock);static unsigned int active_devs;
Signature · 1 line
2.40.1
PATCH 2/6 crypto: qat - removed unused macro in adf_cnv_dbgfs.c
In reply to Adam GuerinThis macro was added but never used, remove it.
This is to fix the following warning when compiling the QAT driver
using the clang compiler with CC=clang W=2:
drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c:19:9: warning: macro is not used [-Wunused-macros]
19 | #define CNV_SLICE_ERR_MASK GENMASK(7, 0)
| ^
--- drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c +0 -1
@@ -16,7 +16,6 @@#define CNV_ERR_INFO_MASK GENMASK(11, 0)#define CNV_ERR_TYPE_MASK GENMASK(15, 12) -#define CNV_SLICE_ERR_MASK GENMASK(7, 0)#define CNV_SLICE_ERR_SIGN_BIT_INDEX 7#define CNV_DELTA_ERR_SIGN_BIT_INDEX 11
Signature · 1 line
2.40.1
PATCH 3/6 crypto: qat - avoid division by zero
In reply to Adam GuerinCheck if delta_us is not zero and return -EINVAL if it is. delta_us is unlikely to be zero as there is a sleep between the reads of the two timestamps.
This is to fix the following warning when compiling the QAT driver using clang scan-build:
drivers/crypto/intel/qat/qat_common/adf_clock.c:87:9: warning: Division by zero [core.DivideZero]
87 | temp = DIV_ROUND_CLOSEST_ULL(temp, delta_us);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/crypto/intel/qat/qat_common/adf_clock.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/intel/qat/qat_common/adf_clock.c +3 -0
@@ -83,6 +83,9 @@ static int measure_clock(struct adf_accel_dev *accel_dev, u32 *frequency) } delta_us =timespec_to_us (&ts3) -timespec_to_us (&ts1); +if (!delta_us) +return -EINVAL ; + temp = (timestamp2 - timestamp1) *ME_CLK_DIVIDER *10 ; temp =DIV_ROUND_CLOSEST_ULL (temp, delta_us);/*
Signature · 1 line
2.40.1
PATCH 4/6 crypto: qat - remove double initialization of value
In reply to Adam GuerinRemove double initialization of the reg variable.
This is to fix the following warning when compiling the QAT driver using clang scan-build:
drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c:1010:6: warning: Value stored to 'reg' during its initialization is never read [deadcode.DeadStores]
1010 | u32 reg = ADF_CSR_RD(csr, ADF_GEN4_SSMCPPERR);
| ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c:1109:6: warning: Value stored to 'reg' during its initialization is never read [deadcode.DeadStores]
1109 | u32 reg = ADF_CSR_RD(csr, ADF_GEN4_SER_ERR_SSMSH);
| ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c +2 -4
@@ -1007,8 +1007,7 @@ static bool adf_handle_spppar_err(struct adf_accel_dev *accel_dev,static bool adf_handle_ssmcpppar_err (struct adf_accel_dev *accel_dev,void __iomem *csr,u32 iastatssm) { -u32 reg =ADF_CSR_RD (csr,ADF_GEN4_SSMCPPERR ); -u32 bits_num =BITS_PER_REG (reg); +u32 reg, bits_num =BITS_PER_REG (reg);bool reset_required = false;unsigned long errs_bits;u32 bit_iterator;
@@ -1106,8 +1105,7 @@ static bool adf_handle_rf_parr_err(struct adf_accel_dev *accel_dev,static bool adf_handle_ser_err_ssmsh (struct adf_accel_dev *accel_dev,void __iomem *csr,u32 iastatssm) { -u32 reg =ADF_CSR_RD (csr,ADF_GEN4_SER_ERR_SSMSH ); -u32 bits_num =BITS_PER_REG (reg); +u32 reg, bits_num =BITS_PER_REG (reg);bool reset_required = false;unsigned long errs_bits;u32 bit_iterator;
Signature · 1 line
2.40.1
PATCH 5/6 crypto: qat - remove unnecessary description from comment
In reply to Adam GuerinRemove extra description from comments as it is not required.
This is to fix the following warning when compiling the QAT driver
using the clang compiler with CC=clang W=2:
drivers/crypto/intel/qat/qat_common/adf_dev_mgr.c:65: warning: contents before sections drivers/crypto/intel/qat/qat_common/adf_isr.c:380: warning: contents before sections drivers/crypto/intel/qat/qat_common/adf_vf_isr.c:298: warning: contents before sections
--- drivers/crypto/intel/qat/qat_common/adf_dev_mgr.c | 4 ++-- drivers/crypto/intel/qat/qat_common/adf_isr.c | 2 -- drivers/crypto/intel/qat/qat_common/adf_vf_isr.c | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_dev_mgr.c +2 -2
@@ -60,10 +60,10 @@ static int adf_get_vf_real_id(u32 fake)/** * adf_clean_vf_map() - Cleans VF id mapings -* -* Function cleans internal ids for virtual functions. * @vf: flag indicating whether mappings is cleaned * for vfs only or for vfs and pfs +* +* Function cleans internal ids for virtual functions. */ void adf_clean_vf_map (bool vf) {
drivers/crypto/intel/qat/qat_common/adf_isr.c +0 -2
@@ -380,8 +380,6 @@ EXPORT_SYMBOL_GPL(adf_isr_resource_alloc);/** * adf_init_misc_wq() - Init misc workqueue * -* Function init workqueue 'qat_misc_wq' for general purpose. -* * Return: 0 on success, error code otherwise. */ int __init adf_init_misc_wq (void )
drivers/crypto/intel/qat/qat_common/adf_vf_isr.c +0 -2
@@ -293,8 +293,6 @@ EXPORT_SYMBOL_GPL(adf_flush_vf_wq);/** * adf_init_vf_wq() - Init workqueue for VF * -* Function init workqueue 'adf_vf_stop_wq' for VF. -* * Return: 0 on success, error code otherwise. */ int __init adf_init_vf_wq (void )
Signature · 1 line
2.40.1
PATCH 6/6 crypto: qat - fix comment structure
In reply to Adam GuerinMove comment description to the same line as the function name.
This is to fix the following warning when compiling the QAT driver
using the clang compiler with CC=clang W=2:
drivers/crypto/intel/qat/qat_common/qat_crypto.c:108: warning: missing initial short description on line:
* qat_crypto_vf_dev_config()
--- drivers/crypto/intel/qat/qat_common/qat_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/intel/qat/qat_common/qat_crypto.c +2 -2
@@ -105,8 +105,8 @@ struct qat_crypto_instance *qat_crypto_get_instance_node(int node) }/** -* qat_crypto_vf_dev_config() -* create dev config required to create crypto inst. +* qat_crypto_vf_dev_config() - create dev config required to create +* crypto inst. * * @accel_dev: Pointer to acceleration device. *
Signature · 1 line
2.40.1
Herbert Xu
maintainerQuoted 26 lines · Adam Guerin
This set fixes a list of warnings found by compiling the QAT driver with "CC=clang W=2" and with the Clang tool scan-build.
These fixes include removing unused macros in both
adf_cnv_dbgfs.candqat_comp_alg.c, fix initialization of multiple variables, check thatdelta_usis not 0, and fixing the comment structures in multiple files.Adam Guerin (6):
crypto: qat - remove unused macros inqat_comp_alg.c
crypto: qat - removed unused macro inadf_cnv_dbgfs.c
crypto: qat - avoid division by zero
crypto: qat - remove double initialization of value
crypto: qat - remove unnecessary description from comment
crypto: qat - fix comment structuredrivers/crypto/intel/qat/qat_common/adf_clock.c | 3 +++ drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c | 1 - drivers/crypto/intel/qat/qat_common/adf_dev_mgr.c | 4 ++-- drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c | 6 ++---- drivers/crypto/intel/qat/qat_common/adf_isr.c | 2 -- drivers/crypto/intel/qat/qat_common/adf_vf_isr.c | 2 -- drivers/crypto/intel/qat/qat_common/qat_comp_algs.c | 9 --------- drivers/crypto/intel/qat/qat_common/qat_crypto.c | 4 ++-- 8 files changed, 9 insertions(+), 22 deletions(-)
Quoted 3 lines
base-commit:
7a35f3adf4535a9a56ef7b3e75355806632030caSignature · 1 line
2.40.1
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt