Skip to contentSkip to conversation

crypto: qat - resolve warnings reported by clang

PATCH In review Giovanni Cabiddu 2 participants 5 messages Mar 4, 2022 – Mar 9, 2022 Crypto API

lore
Share & tools
lore
#0 lore raw

cover crypto: qat - resolve warnings reported by clang

Resolve minor issues reported by clang, when compiling the driver with W=2, and by scan-build.

Giovanni Cabiddu (3):
crypto: qat - remove unneeded assignment
crypto: qat - fix initialization of pfvf cap_msg structures
crypto: qat - fix initialization of pfvf rts_map_msg structures

 drivers/crypto/qat/qat_common/adf_gen4_pfvf.c   | 2 +-
 drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/3 crypto: qat - remove unneeded assignment

The function adf_gen4_get_vf2pf_sources() computes a mask which is stored in a variable which is returned and not used. Remove superfluous assignment of variable.

This is to fix the following warning when compiling the QAT driver with clang scan-build:

    drivers/crypto/qat/qat_common/adf_gen4_pfvf.c:46:9: warning: Although the value stored to 'sou' is used in the enclosing expression, the value is never actually read from 'sou' [deadcode.DeadStores]
            return sou &= ~mask;
                   ^      ~~~~~
Fixes 5901b4af6e07 ("crypto: qat - fix access to PFVF interrupt registers for GEN4")
---
 drivers/crypto/qat/qat_common/adf_gen4_pfvf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_gen4_pfvf.c +1 -1
index 3b3ea849c5e5..d80d493a7756 100644
@@ -43,7 +43,7 @@ static u32 adf_gen4_get_vf2pf_sources(void __iomem *pmisc_addr)
 	sou = ADF_CSR_RD(pmisc_addr, ADF_4XXX_VM2PF_SOU);
 	mask = ADF_CSR_RD(pmisc_addr, ADF_4XXX_VM2PF_MSK);
 
-	return sou &= ~mask;
+	return sou & ~mask;
 }
 
 static void adf_gen4_enable_vf2pf_interrupts(void __iomem *pmisc_addr,
Signature · 1 line
2.35.1
#2 lore raw

PATCH 2/3 crypto: qat - fix initialization of pfvf cap_msg structures

In reply to Giovanni Cabiddu

Initialize fully the structures cap_msg containing the device capabilities from the host.

This is to fix the following warning when compiling the QAT driver using the clang compiler with CC=clang W=2:

    drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c:99:44: warning: missing field 'ext_dc_caps' initializer [-Wmissing-field-initializers]
            struct capabilities_v3 cap_msg = { { 0 }, };
                                                      ^
Fixes 851ed498dba1 ("crypto: qat - exchange device capabilities over PFVF")
---
 drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c +1 -1
index 14b222691c9c..c5b326f63e95 100644
@@ -96,7 +96,7 @@ int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
 int adf_vf2pf_get_capabilities(struct adf_accel_dev *accel_dev)
 {
 	struct adf_hw_device_data *hw_data = accel_dev->hw_device;
-	struct capabilities_v3 cap_msg = { { 0 }, };
+	struct capabilities_v3 cap_msg = { 0 };
 	unsigned int len = sizeof(cap_msg);
 
 	if (accel_dev->vf.pf_compat_ver < ADF_PFVF_COMPAT_CAPABILITIES)
Signature · 1 line
2.35.1
#3 lore raw

PATCH 3/3 crypto: qat - fix initialization of pfvf rts_map_msg structures

In reply to Giovanni Cabiddu

Initialize fully the structures rts_map_msg containing the ring to service map from the host.

This is to fix the following warning when compiling the QAT driver using the clang compiler with CC=clang W=2:

    drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c:144:51: warning: missing field 'map' initializer [-Wmissing-field-initializers]
            struct ring_to_svc_map_v1 rts_map_msg = { { 0 }, };
                                                             ^
Fixes e1b176af3d7e ("crypto: qat - exchange ring-to-service mappings over PFVF")
---
 drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c +1 -1
index c5b326f63e95..1141258db4b6 100644
@@ -141,7 +141,7 @@ int adf_vf2pf_get_capabilities(struct adf_accel_dev *accel_dev)
 
 int adf_vf2pf_get_ring_to_svc(struct adf_accel_dev *accel_dev)
 {
-	struct ring_to_svc_map_v1 rts_map_msg = { { 0 }, };
+	struct ring_to_svc_map_v1 rts_map_msg = { 0 };
 	unsigned int len = sizeof(rts_map_msg);
 
 	if (accel_dev->vf.pf_compat_ver < ADF_PFVF_COMPAT_RING_TO_SVC_MAP)
Signature · 1 line
2.35.1
maintainer
#4 lore raw
In reply to Giovanni Cabiddu
Quoted 11 lines · Giovanni Cabiddu

Resolve minor issues reported by clang, when compiling the driver with W=2, and by scan-build.

Giovanni Cabiddu (3):
crypto: qat - remove unneeded assignment
crypto: qat - fix initialization of pfvf cap_msg structures
crypto: qat - fix initialization of pfvf rts_map_msg structures

 drivers/crypto/qat/qat_common/adf_gen4_pfvf.c   | 2 +-
 drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

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