Re: [PATCH v1 1/3] hwmon: (acpi_power_meter) Drop redundant checks from three functions

From: Guenter Roeck

Date: Sun Mar 01 2026 - 18:54:13 EST


On Sun, Mar 01, 2026 at 02:17:19PM +0100, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
>
> 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@xxxxxxxxx>

Applied.

Thanks,
Guenter