Skip to content

Commit b83afb7

Browse files
committed
ACPI: battery: Drop redundant checks from acpi_battery_remove()
In acpi_battery_remove(), "battery" cannot be NULL because it is the driver data of the platform device passed to that function and it has been set by acpi_battery_probe(), so drop the redundant check of it against NULL. Moreover, getting the ACPI device pointer from battery->device is slightly less overhead than using the ACPI_COMPANION() macro on the platform device to retrieve it, so do that and drop the check of that pointer against NULL which is also redundant. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/12836976.O9o76ZdvQC@rafael.j.wysocki
1 parent abbdf22 commit b83afb7

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

drivers/acpi/battery.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,13 +1271,9 @@ static int acpi_battery_probe(struct platform_device *pdev)
12711271

12721272
static void acpi_battery_remove(struct platform_device *pdev)
12731273
{
1274-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
12751274
struct acpi_battery *battery = platform_get_drvdata(pdev);
12761275

1277-
if (!device || !battery)
1278-
return;
1279-
1280-
acpi_dev_remove_notify_handler(device, ACPI_ALL_NOTIFY,
1276+
acpi_dev_remove_notify_handler(battery->device, ACPI_ALL_NOTIFY,
12811277
acpi_battery_notify);
12821278

12831279
device_init_wakeup(&pdev->dev, false);

0 commit comments

Comments
 (0)