Skip to contentSkip to conversation

crypto: octeontx2 - fix -Wpointer-bool-conversion warning

PATCH In review Arnd Bergmann 3 participants 5 messages Feb 4, 2021 – Feb 10, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 crypto: octeontx2 - fix -Wpointer-bool-conversion warning

From: Arnd Bergmann <[email protected]>

When CONFIG_CPUMASK_OFFSTACK is disabled, clang reports a warning about a bogus condition:

drivers/crypto/marvell/octeontx2/otx2_cptlf.c:334:21: error: address of array 'lfs->lf[slot].affinity_mask' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

                if (lfs->lf[slot].affinity_mask)
                ~~  ~~~~~~~~~~~~~~^~~~~~~~~~~~~

In this configuration, the free_cpumask_var() function does nothing, so the condition could be skipped.

When the option is enabled, there is no warning, but the check is also redundant because free_cpumask_var() falls back to kfree(), which is documented as ignoring NULL pointers.

Remove the check to avoid the warning.

Fixes 64506017030d ("crypto: octeontx2 - add LF framework")
---
 drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptlf.c +1 -2
index e27ea8909368..823a4571fd67 100644
@@ -331,8 +331,7 @@ void otx2_cptlf_free_irqs_affinity(struct otx2_cptlfs_info *lfs)
 			irq_set_affinity_hint(pci_irq_vector(lfs->pdev,
 					      lfs->lf[slot].msix_offset +
 					      offs), NULL);
-		if (lfs->lf[slot].affinity_mask)
-			free_cpumask_var(lfs->lf[slot].affinity_mask);
+		free_cpumask_var(lfs->lf[slot].affinity_mask);
 	}
 }
 
Signature · 1 line
2.29.2
#1 lore raw

PATCH 2/2 crypto: marvell - fix ethernet driver dependency

From: Arnd Bergmann <[email protected]>

The OcteonTX2 CPT driver force-enables the OCTEONTX2_MBOX symbol, which fails when network drivers are disabled globally

WARNING: unmet direct dependencies detected for OCTEONTX2_MBOX
Depends on [n]: NETDEVICES [=n] && ETHERNET [=n] && NET_VENDOR_MARVELL [=n]
Selected by [y]:
- CRYPTO_DEV_OCTEONTX2_CPT [=y] && CRYPTO [=y] && CRYPTO_HW [=y] && (ARM64 [=y] || COMPILE_TEST [=y]) && PCI_MSI [=y] && 64BIT [=y] && CRYPTO_LIB_AES [=y]

The crypto driver actually fails to link without the ethernet side, so this is a hard dependency. Change the 'select' into 'depends on' to make it build reliably without warnings.

Fixes 5e8ce8334734 ("crypto: marvell - add Marvell OcteonTX2 CPT PF driver")
---
 drivers/crypto/marvell/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/marvell/Kconfig +1 -1
index 2efbd79180ce..576d9e46fb88 100644
@@ -39,9 +39,9 @@ config CRYPTO_DEV_OCTEONTX_CPT
 config CRYPTO_DEV_OCTEONTX2_CPT
 	tristate "Marvell OcteonTX2 CPT driver"
 	depends on ARM64 || COMPILE_TEST
+	depends on OCTEONTX2_MBOX
 	depends on PCI_MSI && 64BIT
 	depends on CRYPTO_LIB_AES
-	select OCTEONTX2_MBOX
 	select CRYPTO_DEV_MARVELL
 	select CRYPTO_SKCIPHER
 	select CRYPTO_HASH
Signature · 1 line
2.29.2
maintainer
#2 lore raw

Re: [PATCH 2/2] crypto: marvell - fix ethernet driver dependency

Quoted 14 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The OcteonTX2 CPT driver force-enables the OCTEONTX2_MBOX symbol, which fails when network drivers are disabled globally

WARNING: unmet direct dependencies detected for OCTEONTX2_MBOX
Depends on [n]: NETDEVICES [=n] && ETHERNET [=n] && NET_VENDOR_MARVELL [=n]
Selected by [y]:
- CRYPTO_DEV_OCTEONTX2_CPT [=y] && CRYPTO [=y] && CRYPTO_HW [=y] && (ARM64 [=y] || COMPILE_TEST [=y]) && PCI_MSI [=y] && 64BIT [=y] && CRYPTO_LIB_AES [=y]

The crypto driver actually fails to link without the ethernet side, so this is a hard dependency. Change the 'select' into 'depends on' to make it build reliably without warnings.

Quoted 5 lines
Fixes 5e8ce8334734 ("crypto: marvell - add Marvell OcteonTX2 CPT PF driver")
---
 drivers/crypto/marvell/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

There is already a patch for this:

https://patchwork.kernel.org/project/linux-crypto/patch/[email protected]/

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
Reviewed-by on v1 1/2
#3 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When CONFIG_CPUMASK_OFFSTACK is disabled, clang reports a warning about a bogus condition:

drivers/crypto/marvell/octeontx2/otx2_cptlf.c:334:21: error: address of array 'lfs->lf[slot].affinity_mask' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

                if (lfs->lf[slot].affinity_mask)
                ~~  ~~~~~~~~~~~~~~^~~~~~~~~~~~~

In this configuration, the free_cpumask_var() function does nothing, so the condition could be skipped.

Quoted 8 lines

When the option is enabled, there is no warning, but the check is also redundant because free_cpumask_var() falls back to kfree(), which is documented as ignoring NULL pointers.

Remove the check to avoid the warning.

Fixes 64506017030d ("crypto: octeontx2 - add LF framework")
Quoted 21 lines
---
 drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptlf.c +1 -2
index e27ea8909368..823a4571fd67 100644
@@ -331,8 +331,7 @@ void otx2_cptlf_free_irqs_affinity(struct otx2_cptlfs_info *lfs)
 			irq_set_affinity_hint(pci_irq_vector(lfs->pdev,
 					      lfs->lf[slot].msix_offset +
 					      offs), NULL);
-		if (lfs->lf[slot].affinity_mask)
-			free_cpumask_var(lfs->lf[slot].affinity_mask);
+		free_cpumask_var(lfs->lf[slot].affinity_mask);
 	}
 }
 
Signature · 1 line
2.29.2
maintainer
#4 lore raw
In reply to Arnd Bergmann
Quoted 16 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When CONFIG_CPUMASK_OFFSTACK is disabled, clang reports a warning about a bogus condition:

drivers/crypto/marvell/octeontx2/otx2_cptlf.c:334:21: error: address of array 'lfs->lf[slot].affinity_mask' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

                if (lfs->lf[slot].affinity_mask)
                ~~  ~~~~~~~~~~~~~~^~~~~~~~~~~~~

In this configuration, the free_cpumask_var() function does nothing, so the condition could be skipped.

When the option is enabled, there is no warning, but the check is also redundant because free_cpumask_var() falls back to kfree(), which is documented as ignoring NULL pointers.

Quoted 7 lines

Remove the check to avoid the warning.

Fixes 64506017030d ("crypto: octeontx2 - add LF framework")
---
 drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch 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