[PATCH v1 08/15] ACPI: button: Use local pointer to platform device dev field in probe
From: Rafael J. Wysocki
Date: Mon Jun 01 2026 - 13:18:14 EST
From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
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 <rafael.j.wysocki@xxxxxxxxx>
---
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:
--
2.51.0