Skip to content

Commit

Permalink
ACPI: use kstrto*() instead of simple_strto*()
Browse files Browse the repository at this point in the history
simple_strto*() are obsolete; use kstrto*() instead. Add proper error
checking.

Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Christoph Jaeger authored and Rafael J. Wysocki committed Jun 17, 2014
1 parent 7171511 commit 3d91589
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,10 @@ static ssize_t acpi_battery_write_alarm(struct file *file,
goto end;
}
alarm_string[count] = '\0';
battery->alarm = simple_strtol(alarm_string, NULL, 0);
if (kstrtoint(alarm_string, 0, &battery->alarm)) {
result = -EINVAL;
goto end;
}
result = acpi_battery_set_alarm(battery);
end:
if (!result)
Expand Down
3 changes: 2 additions & 1 deletion drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ void acpi_os_vprintf(const char *fmt, va_list args)
static unsigned long acpi_rsdp;
static int __init setup_acpi_rsdp(char *arg)
{
acpi_rsdp = simple_strtoul(arg, NULL, 16);
if (kstrtoul(arg, 16, &acpi_rsdp))
return -EINVAL;
return 0;
}
early_param("acpi_rsdp", setup_acpi_rsdp);
Expand Down
3 changes: 2 additions & 1 deletion drivers/acpi/tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ static int __init acpi_parse_apic_instance(char *str)
if (!str)
return -EINVAL;

acpi_apic_instance = simple_strtoul(str, NULL, 0);
if (kstrtoint(str, 0, &acpi_apic_instance))
return -EINVAL;

pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance);

Expand Down

0 comments on commit 3d91589

Please sign in to comment.