]> git.ipfire.org Git - thirdparty/linux.git/commit
hwmon: (acpi_power_meter) Drop redundant checks from three functions
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 1 Mar 2026 13:17:19 +0000 (14:17 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 31 Mar 2026 02:45:05 +0000 (19:45 -0700)
commitde19682f9ecbe02a5287060b59e83c3ded8f0a39
treef24f47e514e722c25ddb3ac53098800949e5cb5c
parent0600919f8c25b31042281d1053ac9d88a2caf3fd
hwmon: (acpi_power_meter) Drop redundant checks from three functions

Since acpi_power_meter_notify() and acpi_power_meter_remove() are
.notify() and .remove() callback functions of an ACPI driver,
respectively, the first argument of the former and the only argument
of the latter cannot be NULL.  Likewise, the acpi_power_meter_resume()
argument cannot be NULL because it is a system resume callback
function.

Moreover, since all of these functions can only run after
acpi_power_meter_add() has returned 0, the driver_data field in the
struct acpi_device object used by them cannot be NULL either.

Accordingly, drop the redundant "device" checks against NULL from
acpi_power_meter_notify() and acpi_power_meter_remove(), drop the
redundant "dev" check against NULL from acpi_power_meter_resume(),
and drop the redundant acpi_driver_data() checks against NULL from
all of these functions.

Additionally, combine the initialization of the "resource" local
variable in acpi_power_meter_notify() and acpi_power_meter_remove()
with its declaration.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/5085645.31r3eYUQgx@rafael.j.wysocki
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/acpi_power_meter.c