Skip to content

Commit

Permalink
hwmon: (acpi_power_meter) Fix compiler warning seen in some configura…
Browse files Browse the repository at this point in the history
…tions

In some configurations, BUG() does not result in an endless loop but returns
to the caller. This results in the following compiler warning:

drivers/hwmon/acpi_power_meter.c: In function 'show_str':
drivers/hwmon/acpi_power_meter.c:380: warning: 'val' may be used uninitialized in this function

Fix the warning by setting val to an empty string after BUG().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
  • Loading branch information
Guenter Roeck authored and Guenter Roeck committed Apr 9, 2012
1 parent 8528e07 commit 776cdc1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hwmon/acpi_power_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev,
break;
default:
BUG();
val = "";
}

return sprintf(buf, "%s\n", val);
Expand Down

0 comments on commit 776cdc1

Please sign in to comment.