summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-07-15 03:52:32 +0200
committerRusty Russell <rusty@rustcorp.com.au>2013-07-15 03:55:02 +0200
commit5d7e438629413586ab78779751caa6e713c2234c (patch)
tree6342df34867bb71718fc242dc19adc3ced0360ad /drivers/acpi
parents390: Replace weird use of PTR_RET. (diff)
downloadlinux-5d7e438629413586ab78779751caa6e713c2234c.tar.xz
linux-5d7e438629413586ab78779751caa6e713c2234c.zip
acpi: Replace weird use of PTR_RET.
This functions is really weird. It sets rc to -ENOMEM, then overrides it. It was converted to PTR_RET in a1458187 when it should have simply been rewritten. This version makes it more explicit, with a single IS_ERR() test. Cc: Alexandru Gheorghiu <gheorghiuandru@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpi_pad.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 27bb6a91de5f..46e0b3ca4aba 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -231,16 +231,19 @@ static struct task_struct *ps_tsks[NR_CPUS];
static unsigned int ps_tsk_num;
static int create_power_saving_task(void)
{
- int rc = -ENOMEM;
+ int rc;
ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread,
(void *)(unsigned long)ps_tsk_num,
"acpi_pad/%d", ps_tsk_num);
- rc = PTR_RET(ps_tsks[ps_tsk_num]);
- if (!rc)
- ps_tsk_num++;
- else
+
+ if (IS_ERR(ps_tsks[ps_tsk_num])) {
+ rc = PTR_ERR(ps_tsks[ps_tsk_num]);
ps_tsks[ps_tsk_num] = NULL;
+ } else {
+ rc = 0;
+ ps_tsk_num++;
+ }
return rc;
}