Skip to contentSkip to conversation

hwmon: (hwmon-vid) Add __maybe_unused attribute to dummy variable

PATCH In review Guenter Roeck 2 participants 3 messages Sep 9, 2013 – Sep 10, 2013 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (hwmon-vid) Add __maybe_unused attribute to dummy variable

This gets rid of this warning:

drivers/hwmon/hwmon-vid.c: In function 'get_via_model_d_vrm':
drivers/hwmon/hwmon-vid.c:249:27: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]

---
 drivers/hwmon/hwmon-vid.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/hwmon-vid.c +1 -1
index 89cfd64..ef91b8a 100644
@@ -246,7 +246,7 @@ static struct vrm_model vrm_models[] = {
  */
 static u8 get_via_model_d_vrm(void)
 {
-	unsigned int vid, brand, dummy;
+	unsigned int vid, brand, __maybe_unused dummy;
 	static const char *brands[4] = {
 		"C7-M", "C7", "Eden", "C7-D"
 	};
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Reviewed-by on v1 1/1
#1 lore raw

Hi Guenter,

Quoted 5 lines · Guenter Roeck

This gets rid of this warning:

drivers/hwmon/hwmon-vid.c: In function 'get_via_model_d_vrm':
drivers/hwmon/hwmon-vid.c:249:27: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]

FWIW I no longer see this warning with gcc 4.7.2, but I remember seeing it before.

Quoted 10 lines
---
 drivers/hwmon/hwmon-vid.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/hwmon-vid.c +0 -0
index 89cfd64..ef91b8a 100644

drivers/hwmon/hwmon-vid.c static struct vrm_model vrm_models[] = { · line 252

Quoted 8 lines
drivers/hwmon/hwmon-vid.c +1 -1
@@ -246,7 +246,7 @@ static struct vrm_model vrm_models[] = {
  */
 static u8 get_via_model_d_vrm(void)
 {
-	unsigned int vid, brand, dummy;
+	unsigned int vid, brand, __maybe_unused dummy;
 	static const char *brands[4] = {
 		"C7-M", "C7", "Eden", "C7-D"
 	};

Very nice, I didn't know about this attribute.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#2 lore raw
In reply to Guenter Roeck
Quoted 12 lines · Jean Delvare

Hi Guenter,

Quoted 5 lines · Guenter Roeck

This gets rid of this warning:

drivers/hwmon/hwmon-vid.c: In function 'get_via_model_d_vrm':
drivers/hwmon/hwmon-vid.c:249:27: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]

FWIW I no longer see this warning with gcc 4.7.2, but I remember seeing it before.

I currently use 4.7.3. I think you may not see it anymore unless you build with W=1 (and/or C=1).

Quoted 21 lines
Quoted 10 lines
---
  drivers/hwmon/hwmon-vid.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/hwmon-vid.c +0 -0
index 89cfd64..ef91b8a 100644

drivers/hwmon/hwmon-vid.c static struct vrm_model vrm_models[] = { · line 252

Quoted 8 lines
drivers/hwmon/hwmon-vid.c +1 -1
@@ -246,7 +246,7 @@ static struct vrm_model vrm_models[] = {
   */
  static u8 get_via_model_d_vrm(void)
  {
-	unsigned int vid, brand, dummy;
+	unsigned int vid, brand, __maybe_unused dummy;
  	static const char *brands[4] = {
  		"C7-M", "C7", "Eden", "C7-D"
  	};

Very nice, I didn't know about this attribute.

Quoted 2 lines

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors