Skip to content

Commit 5d7e438

Browse files
committed
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 a145818 when it should have simply been rewritten. This version makes it more explicit, with a single IS_ERR() test. Cc: Alexandru Gheorghiu <[email protected]> Signed-off-by: Rusty Russell <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]>
1 parent 228b822 commit 5d7e438

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/acpi/acpi_pad.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,19 @@ static struct task_struct *ps_tsks[NR_CPUS];
231231
static unsigned int ps_tsk_num;
232232
static int create_power_saving_task(void)
233233
{
234-
int rc = -ENOMEM;
234+
int rc;
235235

236236
ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread,
237237
(void *)(unsigned long)ps_tsk_num,
238238
"acpi_pad/%d", ps_tsk_num);
239-
rc = PTR_RET(ps_tsks[ps_tsk_num]);
240-
if (!rc)
241-
ps_tsk_num++;
242-
else
239+
240+
if (IS_ERR(ps_tsks[ps_tsk_num])) {
241+
rc = PTR_ERR(ps_tsks[ps_tsk_num]);
243242
ps_tsks[ps_tsk_num] = NULL;
243+
} else {
244+
rc = 0;
245+
ps_tsk_num++;
246+
}
244247

245248
return rc;
246249
}

0 commit comments

Comments
 (0)