* [PATCH 1/2] aic94xx: avoid -Wempty-body warning
@ 2021-03-22 10:25 Arnd Bergmann
2021-03-22 10:25 ` [PATCH 2/2] scsi: message: fusion: avoid -Wempty-body warnings Arnd Bergmann
2021-04-06 4:53 ` [PATCH 1/2] aic94xx: avoid -Wempty-body warning Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-03-22 10:25 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: Arnd Bergmann, YueHaibing, linux-scsi, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Building with 'make W=1' shows a harmless -Wempty-body warning:
drivers/scsi/aic94xx/aic94xx_init.c: In function 'asd_free_queues':
drivers/scsi/aic94xx/aic94xx_init.c:858:62: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
858 | ASD_DPRINTK("Uh-oh! Pending is not empty!\n");
Change the empty ASD_DPRINTK() macro to no_printk(), which avoids this
warning and adds format string checking.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/aic94xx/aic94xx.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/aic94xx/aic94xx.h b/drivers/scsi/aic94xx/aic94xx.h
index 98978bc199ff..8f24180646c2 100644
--- a/drivers/scsi/aic94xx/aic94xx.h
+++ b/drivers/scsi/aic94xx/aic94xx.h
@@ -33,7 +33,7 @@
#ifdef ASD_DEBUG
#define ASD_DPRINTK asd_printk
#else
-#define ASD_DPRINTK(fmt, ...)
+#define ASD_DPRINTK(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif
/* 2*ITNL timeout + 1 second */
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] scsi: message: fusion: avoid -Wempty-body warnings
2021-03-22 10:25 [PATCH 1/2] aic94xx: avoid -Wempty-body warning Arnd Bergmann
@ 2021-03-22 10:25 ` Arnd Bergmann
2021-04-06 4:53 ` [PATCH 1/2] aic94xx: avoid -Wempty-body warning Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-03-22 10:25 UTC (permalink / raw)
To: Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani
Cc: Arnd Bergmann, MPT-FusionLinux.pdl, linux-scsi, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
There are a couple of warnings in this driver when building with W=1:
drivers/message/fusion/mptbase.c: In function 'PrimeIocFifos':
drivers/message/fusion/mptbase.c:4608:65: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
4608 | "restoring 64 bit addressing\n", ioc->name));
| ^
drivers/message/fusion/mptbase.c:4633:65: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
4633 | "restoring 64 bit addressing\n", ioc->name));
The macros are slightly suboptimal since are not proper statements.
Change both versions to the usual "do { ... } while (0)" style to
make them more robust and avoid the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/message/fusion/mptdebug.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/message/fusion/mptdebug.h b/drivers/message/fusion/mptdebug.h
index 2205dcab0adb..c281b1359419 100644
--- a/drivers/message/fusion/mptdebug.h
+++ b/drivers/message/fusion/mptdebug.h
@@ -67,12 +67,13 @@
#ifdef CONFIG_FUSION_LOGGING
#define MPT_CHECK_LOGGING(IOC, CMD, BITS) \
-{ \
+do { \
if (IOC->debug_level & BITS) \
CMD; \
-}
+} while (0)
#else
-#define MPT_CHECK_LOGGING(IOC, CMD, BITS)
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS) \
+do { } while (0)
#endif
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] aic94xx: avoid -Wempty-body warning
2021-03-22 10:25 [PATCH 1/2] aic94xx: avoid -Wempty-body warning Arnd Bergmann
2021-03-22 10:25 ` [PATCH 2/2] scsi: message: fusion: avoid -Wempty-body warnings Arnd Bergmann
@ 2021-04-06 4:53 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-04-06 4:53 UTC (permalink / raw)
To: Arnd Bergmann, James E.J. Bottomley
Cc: Martin K . Petersen, linux-scsi, Arnd Bergmann, linux-kernel, YueHaibing
On Mon, 22 Mar 2021 11:25:43 +0100, Arnd Bergmann wrote:
> Building with 'make W=1' shows a harmless -Wempty-body warning:
>
> drivers/scsi/aic94xx/aic94xx_init.c: In function 'asd_free_queues':
> drivers/scsi/aic94xx/aic94xx_init.c:858:62: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 858 | ASD_DPRINTK("Uh-oh! Pending is not empty!\n");
>
> Change the empty ASD_DPRINTK() macro to no_printk(), which avoids this
> warning and adds format string checking.
Applied to 5.13/scsi-queue, thanks!
[1/2] aic94xx: avoid -Wempty-body warning
https://git.kernel.org/mkp/scsi/c/6c26379def09
[2/2] scsi: message: fusion: avoid -Wempty-body warnings
https://git.kernel.org/mkp/scsi/c/472c1cfb10f1
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-06 4:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 10:25 [PATCH 1/2] aic94xx: avoid -Wempty-body warning Arnd Bergmann
2021-03-22 10:25 ` [PATCH 2/2] scsi: message: fusion: avoid -Wempty-body warnings Arnd Bergmann
2021-04-06 4:53 ` [PATCH 1/2] aic94xx: avoid -Wempty-body warning Martin K. Petersen
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).