提交 776cdc11 编写于 作者: G Guenter Roeck 提交者: Guenter Roeck

hwmon: (acpi_power_meter) Fix compiler warning seen in some configurations

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: NGuenter Roeck <linux@roeck-us.net>
Reviewed-by: NRobert Coulson <robert.coulson@ericsson.com>
上级 8528e07e
...@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev, ...@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev,
break; break;
default: default:
BUG(); BUG();
val = "";
} }
return sprintf(buf, "%s\n", val); return sprintf(buf, "%s\n", val);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册