linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/crypto: fix build warnings when DEBUG_FS is not enabled
@ 2023-05-19 22:33 Randy Dunlap
  2023-05-22  0:59 ` Michael Ellerman
  2023-05-24 10:16 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Randy Dunlap @ 2023-05-19 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Breno Leitão, Nayna Jain,
	Paulo Flabiano Smorigo, Herbert Xu, David S. Miller,
	linux-crypto, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, linuxppc-dev

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect [-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)    (0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 |         NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect [-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)    (0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 |                 NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Breno Leitão <leitao@debian.org>
Cc: Nayna Jain <nayna@linux.ibm.com>
Cc: Paulo Flabiano Smorigo <pfsmorigo@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org
---
 drivers/crypto/nx/Makefile |    2 +-
 drivers/crypto/nx/nx.h     |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff -- a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
-		  nx_debugfs.o \
 		  nx-aes-cbc.o \
 		  nx-aes-ecb.o \
 		  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
 		  nx-sha256.o \
 		  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o nx-compress.o
 nx-compress-objs := nx-842.o
diff -- a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct n
 void nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)	(0)
-#define NX_DEBUGFS_FINI(drv)	(0)
+#define NX_DEBUGFS_INIT(drv)	do {} while (0)
+#define NX_DEBUGFS_FINI(drv)	do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x)		((u64)(x) & 0xfffffffffffff000ULL)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/crypto: fix build warnings when DEBUG_FS is not enabled
  2023-05-19 22:33 [PATCH] powerpc/crypto: fix build warnings when DEBUG_FS is not enabled Randy Dunlap
@ 2023-05-22  0:59 ` Michael Ellerman
  2023-05-24 10:16 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-05-22  0:59 UTC (permalink / raw)
  To: Randy Dunlap, linux-kernel, Herbert Xu
  Cc: Breno Leitão, Nayna Jain, Paulo Flabiano Smorigo,
	Herbert Xu, David S. Miller, linux-crypto, Nicholas Piggin,
	Christophe Leroy, linuxppc-dev

Randy Dunlap <rdunlap@infradead.org> writes:
> Fix build warnings when DEBUG_FS is not enabled by using an empty
> do-while loop instead of a value:
>
> In file included from ../drivers/crypto/nx/nx.c:27:
> ../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
> ../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect [-Wunused-value]
>   173 | #define NX_DEBUGFS_INIT(drv)    (0)
> ../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
>   573 |         NX_DEBUGFS_INIT(&nx_driver);
> ../drivers/crypto/nx/nx.c: In function 'nx_remove':
> ../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect [-Wunused-value]
>   174 | #define NX_DEBUGFS_FINI(drv)    (0)
> ../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
>   793 |                 NX_DEBUGFS_FINI(&nx_driver);
>
> Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
> enabled, so change the Makefile to accommodate that.
>
> Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
> Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")

In recent years the subject prefix for this code has been "crypto: nx:"
or similar.

Maybe Herbert can fix it up to his liking when he applies it.

cheers

> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Breno Leitão <leitao@debian.org>
> Cc: Nayna Jain <nayna@linux.ibm.com>
> Cc: Paulo Flabiano Smorigo <pfsmorigo@gmail.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
>  drivers/crypto/nx/Makefile |    2 +-
>  drivers/crypto/nx/nx.h     |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff -- a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
> --- a/drivers/crypto/nx/Makefile
> +++ b/drivers/crypto/nx/Makefile
> @@ -1,7 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0
>  obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
>  nx-crypto-objs := nx.o \
> -		  nx_debugfs.o \
>  		  nx-aes-cbc.o \
>  		  nx-aes-ecb.o \
>  		  nx-aes-gcm.o \
> @@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
>  		  nx-sha256.o \
>  		  nx-sha512.o
>  
> +nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
>  obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o nx-compress.o
>  obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o nx-compress.o
>  nx-compress-objs := nx-842.o
> diff -- a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
> --- a/drivers/crypto/nx/nx.h
> +++ b/drivers/crypto/nx/nx.h
> @@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct n
>  void nx_debugfs_init(struct nx_crypto_driver *);
>  void nx_debugfs_fini(struct nx_crypto_driver *);
>  #else
> -#define NX_DEBUGFS_INIT(drv)	(0)
> -#define NX_DEBUGFS_FINI(drv)	(0)
> +#define NX_DEBUGFS_INIT(drv)	do {} while (0)
> +#define NX_DEBUGFS_FINI(drv)	do {} while (0)
>  #endif
>  
>  #define NX_PAGE_NUM(x)		((u64)(x) & 0xfffffffffffff000ULL)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/crypto: fix build warnings when DEBUG_FS is not enabled
  2023-05-19 22:33 [PATCH] powerpc/crypto: fix build warnings when DEBUG_FS is not enabled Randy Dunlap
  2023-05-22  0:59 ` Michael Ellerman
@ 2023-05-24 10:16 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2023-05-24 10:16 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, Breno Leitão, Nayna Jain,
	Paulo Flabiano Smorigo, David S. Miller, linux-crypto,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	linuxppc-dev

On Fri, May 19, 2023 at 03:33:34PM -0700, Randy Dunlap wrote:
> Fix build warnings when DEBUG_FS is not enabled by using an empty
> do-while loop instead of a value:
> 
> In file included from ../drivers/crypto/nx/nx.c:27:
> ../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
> ../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect [-Wunused-value]
>   173 | #define NX_DEBUGFS_INIT(drv)    (0)
> ../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
>   573 |         NX_DEBUGFS_INIT(&nx_driver);
> ../drivers/crypto/nx/nx.c: In function 'nx_remove':
> ../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect [-Wunused-value]
>   174 | #define NX_DEBUGFS_FINI(drv)    (0)
> ../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
>   793 |                 NX_DEBUGFS_FINI(&nx_driver);
> 
> Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
> enabled, so change the Makefile to accommodate that.
> 
> Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
> Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Breno Leitão <leitao@debian.org>
> Cc: Nayna Jain <nayna@linux.ibm.com>
> Cc: Paulo Flabiano Smorigo <pfsmorigo@gmail.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
>  drivers/crypto/nx/Makefile |    2 +-
>  drivers/crypto/nx/nx.h     |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)

Patch applied.  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] 3+ messages in thread

end of thread, other threads:[~2023-05-24 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-19 22:33 [PATCH] powerpc/crypto: fix build warnings when DEBUG_FS is not enabled Randy Dunlap
2023-05-22  0:59 ` Michael Ellerman
2023-05-24 10:16 ` Herbert Xu

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).