[PATCH v1 10/15] ACPI: button: Drop redundant variable from acpi_button_probe()

From: Rafael J. Wysocki

Date: Mon Jun 01 2026 - 13:17:23 EST


From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>

Local char pointer called "name" in acpi_button_probe() is redundant
because its value can be assigned directly to input->name and the
latter can be used in the only other place where "name" is read, so
get rid of it.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/button.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index dbaf87417428..f0d29870b926 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -548,7 +548,7 @@ static int acpi_button_probe(struct platform_device *pdev)
struct acpi_button *button;
struct input_dev *input;
acpi_status status;
- char *name, *class;
+ char *class;
u8 button_type;
int error = 0;

@@ -581,23 +581,23 @@ static int acpi_button_probe(struct platform_device *pdev)

switch (button_type) {
case ACPI_BUTTON_TYPE_LID:
+ input->name = ACPI_BUTTON_DEVICE_NAME_LID;
handler = acpi_lid_notify;
- name = ACPI_BUTTON_DEVICE_NAME_LID;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
input->open = acpi_lid_input_open;
break;

case ACPI_BUTTON_TYPE_POWER:
+ input->name = ACPI_BUTTON_DEVICE_NAME_POWER;
handler = acpi_button_notify;
- name = ACPI_BUTTON_DEVICE_NAME_POWER;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
break;

case ACPI_BUTTON_TYPE_SLEEP:
+ input->name = ACPI_BUTTON_DEVICE_NAME_SLEEP;
handler = acpi_button_notify;
- name = ACPI_BUTTON_DEVICE_NAME_SLEEP;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
break;
@@ -615,7 +615,6 @@ static int acpi_button_probe(struct platform_device *pdev)

snprintf(button->phys, sizeof(button->phys), "%s/button/input0", id->id);

- input->name = name;
input->phys = button->phys;
input->id.bustype = BUS_HOST;
input->id.product = button_type;
@@ -690,7 +689,7 @@ static int acpi_button_probe(struct platform_device *pdev)
acpi_lid_save(device);
}

- pr_info("%s [%s]\n", name, acpi_device_bid(device));
+ pr_info("%s [%s]\n", input->name, acpi_device_bid(device));
return 0;

err_input_unregister:
--
2.51.0