mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ACPI: battery: Check for error code from devm_mutex_init() call
[ Upstream commit 815daedc318b2f9f1b956d0631377619a0d69d96 ]
Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.
Fixes: 0710c1ce5045 ("ACPI: battery: initialize mutexes through devm_ APIs")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20241030162754.2110946-1-andriy.shevchenko@linux.intel.com
[ rjw: Added 2 empty code lines ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: 399dbcadc01e ("ACPI: battery: Add synchronization between interface updates")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e6c83bbb01
commit
8f03b1bf2b
@@ -1210,8 +1210,14 @@ static int acpi_battery_add(struct acpi_device *device)
|
||||
strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
|
||||
strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
|
||||
device->driver_data = battery;
|
||||
devm_mutex_init(&device->dev, &battery->lock);
|
||||
devm_mutex_init(&device->dev, &battery->sysfs_lock);
|
||||
result = devm_mutex_init(&device->dev, &battery->lock);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
result = devm_mutex_init(&device->dev, &battery->sysfs_lock);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
if (acpi_has_method(battery->device->handle, "_BIX"))
|
||||
set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user