Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: message: fusion: Avoid -Wempty-body warnings

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>

authored by

Arnd Bergmann and committed by
Martin K. Petersen
472c1cfb 6c26379d

+4 -3
+4 -3
drivers/message/fusion/mptdebug.h
··· 67 67 68 68 #ifdef CONFIG_FUSION_LOGGING 69 69 #define MPT_CHECK_LOGGING(IOC, CMD, BITS) \ 70 - { \ 70 + do { \ 71 71 if (IOC->debug_level & BITS) \ 72 72 CMD; \ 73 - } 73 + } while (0) 74 74 #else 75 - #define MPT_CHECK_LOGGING(IOC, CMD, BITS) 75 + #define MPT_CHECK_LOGGING(IOC, CMD, BITS) \ 76 + do { } while (0) 76 77 #endif 77 78 78 79