diff options
Diffstat (limited to 'drivers/acpi/sysfs.c')
-rw-r--r-- | drivers/acpi/sysfs.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 05306a59aedc..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 | ||
@@ -762,13 +767,8 @@ void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, | |||
762 | if (!hotplug_kobj) | 767 | if (!hotplug_kobj) |
763 | goto err_out; | 768 | goto err_out; |
764 | 769 | ||
765 | kobject_init(&hotplug->kobj, &acpi_hotplug_profile_ktype); | 770 | error = kobject_init_and_add(&hotplug->kobj, |
766 | error = kobject_set_name(&hotplug->kobj, "%s", name); | 771 | &acpi_hotplug_profile_ktype, hotplug_kobj, "%s", name); |
767 | if (error) | ||
768 | goto err_out; | ||
769 | |||
770 | hotplug->kobj.parent = hotplug_kobj; | ||
771 | error = kobject_add(&hotplug->kobj, hotplug_kobj, NULL); | ||
772 | if (error) | 772 | if (error) |
773 | goto err_out; | 773 | goto err_out; |
774 | 774 | ||