diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-09-13 19:51:35 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-10-14 01:16:26 +0200 |
commit | 83c97fe13e026a7795a07bfca76fe5d4b5cc5157 (patch) | |
tree | 01a9de593f19b2b8770ee7f693ea291bc6d4b7cf /drivers/hwmon/acpi_power_meter.c | |
parent | hwmon: (gpio_fan) Use error value returned from get_fan_speed_index() (diff) | |
download | linux-83c97fe13e026a7795a07bfca76fe5d4b5cc5157.tar.xz linux-83c97fe13e026a7795a07bfca76fe5d4b5cc5157.zip |
hwmon: (acpi_power_meter) Don't crash the kernel unnecessarily
acpi_power_meter crashes the kernel if it detects an unexpected event
or an internal implementation error. While the detected conditions
suggest that there is a bug in the code, the condition is not fatal.
Replace BUG() with WARN().
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/acpi_power_meter.c')
-rw-r--r-- | drivers/hwmon/acpi_power_meter.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index a9e3d0152c0b..51b045b20c1a 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c @@ -381,8 +381,10 @@ static ssize_t show_str(struct device *dev, val = resource->oem_info; break; default: - BUG(); + WARN(1, "Implementation error: unexpected attribute index %d\n", + attr->index); val = ""; + break; } return sprintf(buf, "%s\n", val); @@ -436,7 +438,9 @@ static ssize_t show_val(struct device *dev, val = resource->trip[attr->index - 7] * 1000; break; default: - BUG(); + WARN(1, "Implementation error: unexpected attribute index %d\n", + attr->index); + break; } return sprintf(buf, "%llu\n", val); @@ -855,7 +859,8 @@ static void acpi_power_meter_notify(struct acpi_device *device, u32 event) dev_info(&device->dev, "Capping in progress.\n"); break; default: - BUG(); + WARN(1, "Unexpected event %d\n", event); + break; } mutex_unlock(&resource->lock); |