Search Linux Wireless

[PATCH 1/3] staging: wilc1000: code style: fix macro with multiple statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Macros with multiple statements should be enclosed in a do - while loop

Signed-off-by: Raphaël Beamonte <raphael.beamonte@xxxxxxxxx>
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c
index 5294578..45c2c7e 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -12,11 +12,13 @@
 	void *exported_ ## name = NULL;
 
 #define MALLOC_WILC_BUFFER(name, size)	\
-	exported_ ## name = kmalloc(size, GFP_KERNEL);	  \
-	if (!exported_ ## name) {   \
-		printk("fail to alloc: %s memory\n", exported_ ## name);  \
-		return -ENOBUFS;	\
-	}
+	do { \
+		exported_ ## name = kmalloc(size, GFP_KERNEL);	  \
+		if (!exported_ ## name) {   \
+			printk("fail to alloc: %s memory\n", exported_ ## name);  \
+			return -ENOBUFS;	\
+		}
+	} while (0)
 
 #define FREE_WILC_BUFFER(name)	\
 	kfree(exported_ ## name);
@@ -73,4 +75,4 @@ MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Tony Cho");
 MODULE_DESCRIPTION("WILC1xxx Memory Manager");
 pure_initcall(wilc_module_init);
-module_exit(wilc_module_deinit);
\ No newline at end of file
+module_exit(wilc_module_deinit);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux