Skip to content

Commit

Permalink
cpuidle: Clean up fallback handling in cpuidle_idle_call()
Browse files Browse the repository at this point in the history
Move the fallback code path in cpuidle_idle_call() to the end of the
function to avoid jumping to a label in an if () branch.

Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
rafaeljw committed Mar 2, 2015
1 parent 31a3409 commit dfcacc1
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions kernel/sched/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,8 @@ static void cpuidle_idle_call(void)
* Fall back to the default arch idle method on errors.
*/
next_state = cpuidle_select(drv, dev);
if (next_state < 0) {
use_default:
/*
* We can't use the cpuidle framework, let's use the default
* idle routine.
*/
if (current_clr_polling_and_test())
local_irq_enable();
else
arch_cpu_idle();

goto exit_idle;
}

if (next_state < 0)
goto use_default;

/*
* The idle task must be scheduled, it is pointless to
Expand Down Expand Up @@ -195,6 +183,19 @@ static void cpuidle_idle_call(void)

rcu_idle_exit();
start_critical_timings();
return;

use_default:
/*
* We can't use the cpuidle framework, let's use the default
* idle routine.
*/
if (current_clr_polling_and_test())
local_irq_enable();
else
arch_cpu_idle();

goto exit_idle;
}

/*
Expand Down

0 comments on commit dfcacc1

Please sign in to comment.