scsi: message: fusion: Avoid -Wempty-body warnings
authorArnd Bergmann <arnd@arndb.de>
Mon, 22 Mar 2021 10:25:44 +0000 (11:25 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 2 Apr 2021 02:55:25 +0000 (22:55 -0400)
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.

Link: https://lore.kernel.org/r/20210322102549.278661-2-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/message/fusion/mptdebug.h

index 2205dca..c281b13 100644 (file)
 
 #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