]> www.infradead.org Git - users/dwmw2/linux.git/commit
hwmon: (acpi_power_meter) Fix uninitialized variables
authorHuisong Li <lihuisong@huawei.com>
Thu, 9 Jan 2025 08:17:07 +0000 (16:17 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 9 Jan 2025 20:44:25 +0000 (12:44 -0800)
commit7532e68f5d8f05353765d7585a791a14985d68b7
treed89cdfed0c5d42bf2d052611ed0cc181b05b87d1
parentc909e68f81279cb5147c6f4a7ecf80e4c6c19b04
hwmon: (acpi_power_meter) Fix uninitialized variables

The 'power1_alarm' attribute uses the 'power' and 'cap' in the
acpi_power_meter_resource structure. Currently, these two fields are just
updated when user query 'power' and 'cap' attribute. If user directly query
the 'power1_alarm' attribute without queryng above two attributes, driver
will use uninitialized variables to judge.

So this patch adds the setting of alarm state and update 'cap' in the
notification callback and update 'power' and 'cap' if needed to show the
real alarm state.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Link: https://lore.kernel.org/r/20250109081708.27366-2-lihuisong@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/acpi_power_meter.c