Messages in this thread Patch in this message | | | Subject | [PATCH] memblock: Make memblock_dbg macro safer | From | Joe Perches <> | Date | Sun, 12 Feb 2012 13:59:37 -0800 |
| |
Allow this macro to be used in an if/else block.
Use do {} while (0) and pr_info. (perhaps this should be pr_debug)
Signed-off-by: Joe Perches <joe@perches.com> --- include/linux/memblock.h | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index a6bb102..0584d13 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -43,8 +43,11 @@ struct memblock { extern struct memblock memblock; extern int memblock_debug; -#define memblock_dbg(fmt, ...) \ - if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) +#define memblock_dbg(fmt, ...) \ +do { \ + if (memblock_debug) \ + pr_info(fmt, ##__VA_ARGS__); \ +} while (0) phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end, phys_addr_t size, phys_addr_t align, int nid);
| |