From 1ad8cdd308da9f9ff044ac49cbe1a375f96c3404 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Mon, 1 Jun 2026 19:01:41 +0200 Subject: [PATCH] ACPI: button: Use local pointer to platform device dev field in probe To avoid dereferencing pdev to get to the target platform device's dev field in multiple places in acpi_button_probe(), use a local pointer to that field. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/2049596.PYKUYFuaPT@rafael.j.wysocki --- drivers/acpi/button.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 236eb025bb0d..9fe8d212b606 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -541,6 +541,7 @@ static int acpi_lid_input_open(struct input_dev *input) static int acpi_button_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; acpi_notify_handler handler; struct acpi_device *device; struct acpi_button *button; @@ -550,7 +551,7 @@ static int acpi_button_probe(struct platform_device *pdev) const char *hid; int error = 0; - device = ACPI_COMPANION(&pdev->dev); + device = ACPI_COMPANION(dev); if (!device) return -ENODEV; @@ -565,7 +566,7 @@ static int acpi_button_probe(struct platform_device *pdev) platform_set_drvdata(pdev, button); - button->dev = &pdev->dev; + button->dev = dev; button->adev = device; button->input = input = input_allocate_device(); if (!input) { @@ -615,7 +616,7 @@ static int acpi_button_probe(struct platform_device *pdev) input->phys = button->phys; input->id.bustype = BUS_HOST; input->id.product = button->type; - input->dev.parent = &pdev->dev; + input->dev.parent = dev; switch (button->type) { case ACPI_BUTTON_TYPE_POWER: