aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPhil Carmody <ext-phil.2.carmody@nokia.com>2011-07-14 08:07:13 -0400
committerJiri Kosina <jkosina@suse.cz>2011-07-21 08:10:00 -0400
commit497888cf69bf607ac1fe061a6437e0a670b0022f (patch)
treeac0897eff214f09c89d5f4fbc3c03ef9d010a83c /drivers
parent06b72d06d6b182bdaaaec686dbd8b602949521ee (diff)
treewide: fix potentially dangerous trailing ';' in #defined values/expressions
All these are instances of #define NAME value; or #define NAME(params_opt) value; These of course fail to build when used in contexts like if(foo $OP NAME) while(bar $OP NAME) and may silently generate the wrong code in contexts such as foo = NAME + 1; /* foo = value; + 1; */ bar = NAME - 1; /* bar = value; - 1; */ baz = NAME & quux; /* baz = value; & quux; */ Reported on comp.lang.c, Message-ID: <ab0d55fe-25e5-482b-811e-c475aa6065c3@c29g2000yqd.googlegroups.com> Initial analysis of the dangers provided by Keith Thompson in that thread. There are many more instances of more complicated macros having unnecessary trailing semicolons, but this pile seems to be all of the cases of simple values suffering from the problem. (Thus things that are likely to be found in one of the contexts above, more complicated ones aren't.) Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/ac.c2
-rw-r--r--drivers/acpi/battery.c2
-rw-r--r--drivers/acpi/sbs.c2
-rw-r--r--drivers/gpu/drm/sis/sis_drv.h4
-rw-r--r--drivers/hwmon/gl520sm.c2
-rw-r--r--drivers/isdn/i4l/isdn_bsdcomp.c2
-rw-r--r--drivers/net/bsd_comp.c2
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/s2io.h4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-commands.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/reg.h4
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h8
-rw-r--r--drivers/usb/otg/twl4030-usb.c2
-rw-r--r--drivers/video/i810/i810.h2
17 files changed, 25 insertions, 25 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 58c3f74bd84c..6512b20aeccd 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -89,7 +89,7 @@ struct acpi_ac {
89 unsigned long long state; 89 unsigned long long state;
90}; 90};
91 91
92#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); 92#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger)
93 93
94#ifdef CONFIG_ACPI_PROCFS_POWER 94#ifdef CONFIG_ACPI_PROCFS_POWER
95static const struct file_operations acpi_ac_fops = { 95static const struct file_operations acpi_ac_fops = {
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index fcc13ac0aa18..2c661353e8f2 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -132,7 +132,7 @@ struct acpi_battery {
132 unsigned long flags; 132 unsigned long flags;
133}; 133};
134 134
135#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 135#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat)
136 136
137inline int acpi_battery_present(struct acpi_battery *battery) 137inline int acpi_battery_present(struct acpi_battery *battery)
138{ 138{
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 51ae3794ec7f..50658ff887d9 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -112,7 +112,7 @@ struct acpi_battery {
112 u8 have_sysfs_alarm:1; 112 u8 have_sysfs_alarm:1;
113}; 113};
114 114
115#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 115#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat)
116 116
117struct acpi_sbs { 117struct acpi_sbs {
118 struct power_supply charger; 118 struct power_supply charger;
diff --git a/drivers/gpu/drm/sis/sis_drv.h b/drivers/gpu/drm/sis/sis_drv.h
index ef940bad63f7..194303c177ad 100644
--- a/drivers/gpu/drm/sis/sis_drv.h
+++ b/drivers/gpu/drm/sis/sis_drv.h
@@ -48,8 +48,8 @@ enum sis_family {
48 48
49 49
50#define SIS_BASE (dev_priv->mmio) 50#define SIS_BASE (dev_priv->mmio)
51#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg); 51#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg)
52#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val); 52#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val)
53 53
54typedef struct drm_sis_private { 54typedef struct drm_sis_private {
55 drm_local_map_t *mmio; 55 drm_local_map_t *mmio;
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index ec588026f0a9..131ea8625f08 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -273,7 +273,7 @@ static SENSOR_DEVICE_ATTR(in4_max, S_IRUGO | S_IWUSR,
273 273
274#define DIV_FROM_REG(val) (1 << (val)) 274#define DIV_FROM_REG(val) (1 << (val))
275#define FAN_FROM_REG(val,div) ((val)==0 ? 0 : (480000/((val) << (div)))) 275#define FAN_FROM_REG(val,div) ((val)==0 ? 0 : (480000/((val) << (div))))
276#define FAN_TO_REG(val,div) ((val)<=0?0:SENSORS_LIMIT((480000 + ((val) << ((div)-1))) / ((val) << (div)), 1, 255)); 276#define FAN_TO_REG(val,div) ((val)<=0?0:SENSORS_LIMIT((480000 + ((val) << ((div)-1))) / ((val) << (div)), 1, 255))
277 277
278static ssize_t get_fan_input(struct device *dev, struct device_attribute *attr, 278static ssize_t get_fan_input(struct device *dev, struct device_attribute *attr,
279 char *buf) 279 char *buf)
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c
index 02d9918705dd..aa0b6a6f5ef4 100644
--- a/drivers/isdn/i4l/isdn_bsdcomp.c
+++ b/drivers/isdn/i4l/isdn_bsdcomp.c
@@ -155,7 +155,7 @@ struct bsd_db {
155#define LAST 255 155#define LAST 255
156 156
157#define MAXCODE(b) ((1 << (b)) - 1) 157#define MAXCODE(b) ((1 << (b)) - 1)
158#define BADCODEM1 MAXCODE(MAX_BSD_BITS); 158#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
159 159
160#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \ 160#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \
161 ^ (unsigned long)(prefix)) 161 ^ (unsigned long)(prefix))
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c
index 6e99d80ec409..a9b759add187 100644
--- a/drivers/net/bsd_comp.c
+++ b/drivers/net/bsd_comp.c
@@ -201,7 +201,7 @@ extern void ppp_unregister_compressor (struct compressor *cp);
201#define LAST 255 201#define LAST 255
202 202
203#define MAXCODE(b) ((1 << (b)) - 1) 203#define MAXCODE(b) ((1 << (b)) - 1)
204#define BADCODEM1 MAXCODE(MAX_BSD_BITS); 204#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
205 205
206#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \ 206#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \
207 ^ (unsigned long)(prefix)) 207 ^ (unsigned long)(prefix))
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 68e6b0224edd..c69f82a17c28 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1382,7 +1382,7 @@ static int find_mii(struct net_device *dev)
1382/* WCSR bits [0:4] [9:10] */ 1382/* WCSR bits [0:4] [9:10] */
1383#define WCSR_RESET_SAVE 0x61f 1383#define WCSR_RESET_SAVE 0x61f
1384/* RFCR bits [20] [22] [27:31] */ 1384/* RFCR bits [20] [22] [27:31] */
1385#define RFCR_RESET_SAVE 0xf8500000; 1385#define RFCR_RESET_SAVE 0xf8500000
1386 1386
1387static void natsemi_reset(struct net_device *dev) 1387static void natsemi_reset(struct net_device *dev)
1388{ 1388{
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 5990621fb5cd..6f3630618fa8 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -667,7 +667,7 @@ struct rtl8169_private {
667 u32 saved_wolopts; 667 u32 saved_wolopts;
668 668
669 const struct firmware *fw; 669 const struct firmware *fw;
670#define RTL_FIRMWARE_UNKNOWN ERR_PTR(-EAGAIN); 670#define RTL_FIRMWARE_UNKNOWN ERR_PTR(-EAGAIN)
671}; 671};
672 672
673MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); 673MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 800b3a44e653..57a4dc7c7d7a 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -968,8 +968,8 @@ struct s2io_nic {
968 u8 serial_num[VPD_STRING_LEN]; 968 u8 serial_num[VPD_STRING_LEN];
969}; 969};
970 970
971#define RESET_ERROR 1; 971#define RESET_ERROR 1
972#define CMD_ERROR 2; 972#define CMD_ERROR 2
973 973
974/* OS related system calls */ 974/* OS related system calls */
975#ifndef readq 975#ifndef readq
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index 17a1d504348e..6a5c76e7345f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -2624,8 +2624,8 @@ struct iwl_scanstart_notification {
2624 __le32 status; 2624 __le32 status;
2625} __packed; 2625} __packed;
2626 2626
2627#define SCAN_OWNER_STATUS 0x1; 2627#define SCAN_OWNER_STATUS 0x1
2628#define MEASURE_OWNER_STATUS 0x2; 2628#define MEASURE_OWNER_STATUS 0x2
2629 2629
2630#define IWL_PROBE_STATUS_OK 0 2630#define IWL_PROBE_STATUS_OK 0
2631#define IWL_PROBE_STATUS_TX_FAILED BIT(0) 2631#define IWL_PROBE_STATUS_TX_FAILED BIT(0)
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 6ee5f1aa555c..6288d1fdfcc6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -2457,8 +2457,8 @@ struct iwl_scanstart_notification {
2457 __le32 status; 2457 __le32 status;
2458} __packed; 2458} __packed;
2459 2459
2460#define SCAN_OWNER_STATUS 0x1; 2460#define SCAN_OWNER_STATUS 0x1
2461#define MEASURE_OWNER_STATUS 0x2; 2461#define MEASURE_OWNER_STATUS 0x2
2462 2462
2463#define IWL_PROBE_STATUS_OK 0 2463#define IWL_PROBE_STATUS_OK 0
2464#define IWL_PROBE_STATUS_TX_FAILED BIT(0) 2464#define IWL_PROBE_STATUS_TX_FAILED BIT(0)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
index 598cecc63f41..5b43749031dd 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
@@ -1074,10 +1074,10 @@
1074#define _SRL(x) (((x) & 0x3F) << 8) 1074#define _SRL(x) (((x) & 0x3F) << 8)
1075 1075
1076#define _SIFS_CCK_CTX(x) ((x) & 0xFF) 1076#define _SIFS_CCK_CTX(x) ((x) & 0xFF)
1077#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8); 1077#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8)
1078 1078
1079#define _SIFS_OFDM_CTX(x) ((x) & 0xFF) 1079#define _SIFS_OFDM_CTX(x) ((x) & 0xFF)
1080#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8); 1080#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8)
1081 1081
1082#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8) 1082#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8)
1083 1083
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index e7fc70d6b478..2e7c136bb805 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -35,7 +35,7 @@
35 * mode page were taken from the LSI RDAC 2.4 GPL'd 35 * mode page were taken from the LSI RDAC 2.4 GPL'd
36 * driver, and then converted to Linux conventions. 36 * driver, and then converted to Linux conventions.
37 */ 37 */
38#define RDAC_QUIESCENCE_TIME 20; 38#define RDAC_QUIESCENCE_TIME 20
39/* 39/*
40 * Page Codes 40 * Page Codes
41 */ 41 */
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 9059524cf225..ab4c4d651d0c 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -2955,18 +2955,18 @@ typedef struct _SLI2_RDSC {
2955typedef struct _PCB { 2955typedef struct _PCB {
2956#ifdef __BIG_ENDIAN_BITFIELD 2956#ifdef __BIG_ENDIAN_BITFIELD
2957 uint32_t type:8; 2957 uint32_t type:8;
2958#define TYPE_NATIVE_SLI2 0x01; 2958#define TYPE_NATIVE_SLI2 0x01
2959 uint32_t feature:8; 2959 uint32_t feature:8;
2960#define FEATURE_INITIAL_SLI2 0x01; 2960#define FEATURE_INITIAL_SLI2 0x01
2961 uint32_t rsvd:12; 2961 uint32_t rsvd:12;
2962 uint32_t maxRing:4; 2962 uint32_t maxRing:4;
2963#else /* __LITTLE_ENDIAN_BITFIELD */ 2963#else /* __LITTLE_ENDIAN_BITFIELD */
2964 uint32_t maxRing:4; 2964 uint32_t maxRing:4;
2965 uint32_t rsvd:12; 2965 uint32_t rsvd:12;
2966 uint32_t feature:8; 2966 uint32_t feature:8;
2967#define FEATURE_INITIAL_SLI2 0x01; 2967#define FEATURE_INITIAL_SLI2 0x01
2968 uint32_t type:8; 2968 uint32_t type:8;
2969#define TYPE_NATIVE_SLI2 0x01; 2969#define TYPE_NATIVE_SLI2 0x01
2970#endif 2970#endif
2971 2971
2972 uint32_t mailBoxSize; 2972 uint32_t mailBoxSize;
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index efeb4d1517ff..14f66c358629 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -166,7 +166,7 @@ struct twl4030_usb {
166}; 166};
167 167
168/* internal define on top of container_of */ 168/* internal define on top of container_of */
169#define xceiv_to_twl(x) container_of((x), struct twl4030_usb, otg); 169#define xceiv_to_twl(x) container_of((x), struct twl4030_usb, otg)
170 170
171/*-------------------------------------------------------------------------*/ 171/*-------------------------------------------------------------------------*/
172 172
diff --git a/drivers/video/i810/i810.h b/drivers/video/i810/i810.h
index f37de60ecc59..1414b73ac55b 100644
--- a/drivers/video/i810/i810.h
+++ b/drivers/video/i810/i810.h
@@ -137,7 +137,7 @@
137#define DRAM_ON 0x08 137#define DRAM_ON 0x08
138#define DRAM_OFF 0xE7 138#define DRAM_OFF 0xE7
139#define PG_ENABLE_MASK 0x01 139#define PG_ENABLE_MASK 0x01
140#define RING_SIZE_MASK (RINGBUFFER_SIZE - 1); 140#define RING_SIZE_MASK (RINGBUFFER_SIZE - 1)
141 141
142/* defines for restoring registers partially */ 142/* defines for restoring registers partially */
143#define ADDR_MAP_MASK (0x07 << 5) 143#define ADDR_MAP_MASK (0x07 << 5)