Staging: rts5208: Fix Macro argument reuse
PATCH 2/2 Staging: rts5208: Fix Macro argument reuse
Fix Macro argument reuse to avoid possible side effects
Signed-off-by Bhanusree Pola <[email protected]>
--- drivers/staging/rts5208/xd.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/rts5208/xd.h +5 -4
@@ -99,11 +99,12 @@#define XD_RW_ADDR 0x01#define XD_ERASE_ADDR 0x02 -#define XD_PAGE_512 (xd_card) \ +#define XD_PAGE_512 (_card) \ +(typeof(_card) (card) = (_card); \ do { \ - (xd_card)->block_shift = 5; \ - (xd_card)->page_off = 0x1F; \ -} while (0) + (card)->block_shift = 5; \ + (card)->page_off = 0x1F; \ +} while (0))#define XD_SET_BAD_NEWBLK (xd_card) ((xd_card)->multi_flag |= 0x01)#define XD_CLR_BAD_NEWBLK (xd_card) ((xd_card)->multi_flag &= ~0x01)
Signature · 1 line
2.17.1
Greg Kroah-Hartman
maintainerQuoted 1 line · Bhanusree Pola
Fix Macro argument reuse to avoid possible side effects
What side effects? Always be specific.
And if you do something like this, make it an inline function, that way the type can be properly checked.
thanks,
greg k-h