Skip to content

Commit aa7d6c0

Browse files
committed
ACPI: button: Drop redundant variable from acpi_button_probe()
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@intel.com> Link: https://patch.msgid.link/3706239.iIbC2pHGDl@rafael.j.wysocki
1 parent c16c205 commit aa7d6c0

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

drivers/acpi/button.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ static int acpi_button_probe(struct platform_device *pdev)
548548
struct acpi_button *button;
549549
struct input_dev *input;
550550
acpi_status status;
551-
char *name, *class;
551+
char *class;
552552
u8 button_type;
553553
int error = 0;
554554

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

582582
switch (button_type) {
583583
case ACPI_BUTTON_TYPE_LID:
584+
input->name = ACPI_BUTTON_DEVICE_NAME_LID;
584585
handler = acpi_lid_notify;
585-
name = ACPI_BUTTON_DEVICE_NAME_LID;
586586
sprintf(class, "%s/%s",
587587
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
588588
input->open = acpi_lid_input_open;
589589
break;
590590

591591
case ACPI_BUTTON_TYPE_POWER:
592+
input->name = ACPI_BUTTON_DEVICE_NAME_POWER;
592593
handler = acpi_button_notify;
593-
name = ACPI_BUTTON_DEVICE_NAME_POWER;
594594
sprintf(class, "%s/%s",
595595
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
596596
break;
597597

598598
case ACPI_BUTTON_TYPE_SLEEP:
599+
input->name = ACPI_BUTTON_DEVICE_NAME_SLEEP;
599600
handler = acpi_button_notify;
600-
name = ACPI_BUTTON_DEVICE_NAME_SLEEP;
601601
sprintf(class, "%s/%s",
602602
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
603603
break;
@@ -616,7 +616,6 @@ static int acpi_button_probe(struct platform_device *pdev)
616616

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

619-
input->name = name;
620619
input->phys = button->phys;
621620
input->id.bustype = BUS_HOST;
622621
input->id.product = button_type;
@@ -691,7 +690,7 @@ static int acpi_button_probe(struct platform_device *pdev)
691690
acpi_lid_save(device);
692691
}
693692

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

697696
err_input_unregister:

0 commit comments

Comments
 (0)