diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-07-14 21:52:32 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-07-14 21:55:02 -0400 |
commit | 5d7e438629413586ab78779751caa6e713c2234c (patch) | |
tree | 6342df34867bb71718fc242dc19adc3ced0360ad /drivers/acpi | |
parent | 228b82211b47b597fa75dff2ac146b40eaaddf18 (diff) |
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.c | 13 |
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]; | |||
231 | static unsigned int ps_tsk_num; | 231 | static unsigned int ps_tsk_num; |
232 | static int create_power_saving_task(void) | 232 | static int create_power_saving_task(void) |
233 | { | 233 | { |
234 | int rc = -ENOMEM; | 234 | int rc; |
235 | 235 | ||
236 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, | 236 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, |
237 | (void *)(unsigned long)ps_tsk_num, | 237 | (void *)(unsigned long)ps_tsk_num, |
238 | "acpi_pad/%d", ps_tsk_num); | 238 | "acpi_pad/%d", ps_tsk_num); |
239 | rc = PTR_RET(ps_tsks[ps_tsk_num]); | 239 | |
240 | if (!rc) | 240 | if (IS_ERR(ps_tsks[ps_tsk_num])) { |
241 | ps_tsk_num++; | 241 | rc = PTR_ERR(ps_tsks[ps_tsk_num]); |
242 | else | ||
243 | ps_tsks[ps_tsk_num] = NULL; | 242 | ps_tsks[ps_tsk_num] = NULL; |
243 | } else { | ||
244 | rc = 0; | ||
245 | ps_tsk_num++; | ||
246 | } | ||
244 | 247 | ||
245 | return rc; | 248 | return rc; |
246 | } | 249 | } |