--- zzzz-none-000/linux-3.10.107/drivers/hwmon/acpi_power_meter.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/hwmon/acpi_power_meter.c 2021-02-04 17:41:59.000000000 +0000 @@ -2,7 +2,7 @@ * A hwmon driver for ACPI 4.0 power meters * Copyright (C) 2009 IBM * - * Author: Darrick J. Wong + * Author: Darrick J. Wong * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +30,7 @@ #include #include #include -#include -#include +#include #define ACPI_POWER_METER_NAME "power_meter" ACPI_MODULE_NAME(ACPI_POWER_METER_NAME); @@ -381,8 +380,10 @@ 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 +437,9 @@ 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); @@ -598,9 +601,8 @@ /* Create a symlink to domain objects */ resource->domain_devices[i] = NULL; - status = acpi_bus_get_device(element->reference.handle, - &resource->domain_devices[i]); - if (ACPI_FAILURE(status)) + if (acpi_bus_get_device(element->reference.handle, + &resource->domain_devices[i])) continue; obj = resource->domain_devices[i]; @@ -855,7 +857,8 @@ dev_info(&device->dev, "Capping in progress.\n"); break; default: - BUG(); + WARN(1, "Unexpected event %d\n", event); + break; } mutex_unlock(&resource->lock); @@ -991,7 +994,7 @@ result = acpi_bus_register_driver(&acpi_power_meter_driver); if (result < 0) - return -ENODEV; + return result; return 0; } @@ -1001,7 +1004,7 @@ acpi_bus_unregister_driver(&acpi_power_meter_driver); } -MODULE_AUTHOR("Darrick J. Wong "); +MODULE_AUTHOR("Darrick J. Wong "); MODULE_DESCRIPTION("ACPI 4.0 power meter driver"); MODULE_LICENSE("GPL");