diff options
Diffstat (limited to 'drivers/acpi/sysfs.c')
-rw-r--r-- | drivers/acpi/sysfs.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index bb6045c5385b..db5293650f62 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -564,6 +564,7 @@ static ssize_t counter_set(struct kobject *kobj, | |||
564 | acpi_event_status status; | 564 | acpi_event_status status; |
565 | acpi_handle handle; | 565 | acpi_handle handle; |
566 | int result = 0; | 566 | int result = 0; |
567 | unsigned long tmp; | ||
567 | 568 | ||
568 | if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) { | 569 | if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) { |
569 | int i; | 570 | int i; |
@@ -596,8 +597,10 @@ static ssize_t counter_set(struct kobject *kobj, | |||
596 | else if (!strcmp(buf, "clear\n") && | 597 | else if (!strcmp(buf, "clear\n") && |
597 | (status & ACPI_EVENT_FLAG_SET)) | 598 | (status & ACPI_EVENT_FLAG_SET)) |
598 | result = acpi_clear_gpe(handle, index); | 599 | result = acpi_clear_gpe(handle, index); |
600 | else if (!kstrtoul(buf, 0, &tmp)) | ||
601 | all_counters[index].count = tmp; | ||
599 | else | 602 | else |
600 | all_counters[index].count = strtoul(buf, NULL, 0); | 603 | result = -EINVAL; |
601 | } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) { | 604 | } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) { |
602 | int event = index - num_gpes; | 605 | int event = index - num_gpes; |
603 | if (!strcmp(buf, "disable\n") && | 606 | if (!strcmp(buf, "disable\n") && |
@@ -609,8 +612,10 @@ static ssize_t counter_set(struct kobject *kobj, | |||
609 | else if (!strcmp(buf, "clear\n") && | 612 | else if (!strcmp(buf, "clear\n") && |
610 | (status & ACPI_EVENT_FLAG_SET)) | 613 | (status & ACPI_EVENT_FLAG_SET)) |
611 | result = acpi_clear_event(event); | 614 | result = acpi_clear_event(event); |
615 | else if (!kstrtoul(buf, 0, &tmp)) | ||
616 | all_counters[index].count = tmp; | ||
612 | else | 617 | else |
613 | all_counters[index].count = strtoul(buf, NULL, 0); | 618 | result = -EINVAL; |
614 | } else | 619 | } else |
615 | all_counters[index].count = strtoul(buf, NULL, 0); | 620 | all_counters[index].count = strtoul(buf, NULL, 0); |
616 | 621 | ||