提交 5d7e4386 编写于 作者: R Rusty Russell

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: NRusty Russell <rusty@rustcorp.com.au>
Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 228b8221
...@@ -231,16 +231,19 @@ static struct task_struct *ps_tsks[NR_CPUS]; ...@@ -231,16 +231,19 @@ static struct task_struct *ps_tsks[NR_CPUS];
static unsigned int ps_tsk_num; static unsigned int ps_tsk_num;
static int create_power_saving_task(void) static int create_power_saving_task(void)
{ {
int rc = -ENOMEM; int rc;
ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread,
(void *)(unsigned long)ps_tsk_num, (void *)(unsigned long)ps_tsk_num,
"acpi_pad/%d", ps_tsk_num); "acpi_pad/%d", ps_tsk_num);
rc = PTR_RET(ps_tsks[ps_tsk_num]);
if (!rc) if (IS_ERR(ps_tsks[ps_tsk_num])) {
ps_tsk_num++; rc = PTR_ERR(ps_tsks[ps_tsk_num]);
else
ps_tsks[ps_tsk_num] = NULL; ps_tsks[ps_tsk_num] = NULL;
} else {
rc = 0;
ps_tsk_num++;
}
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册