Skip to content

Commit

Permalink
clocksource: Don't walk the clocksource list for empty override
Browse files Browse the repository at this point in the history
If the override clocksource name is empty there is no point in walking the
clocksource list for a match.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: arnd@arndb.de
Cc: sboyd@codeaurora.org
Cc: broonie@kernel.org
Cc: john.stultz@linaro.org
Link: https://lkml.kernel.org/r/069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org
  • Loading branch information
Baolin Wang authored and Thomas Gleixner committed Feb 28, 2018
1 parent 4a3928c commit 7f852af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kernel/time/clocksource.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ static void __clocksource_select(bool skipcur)
if (!best)
return;

if (!strlen(override_name))
goto found;

/* Check for the override clocksource. */
list_for_each_entry(cs, &clocksource_list, list) {
if (skipcur && cs == curr_clocksource)
Expand Down Expand Up @@ -625,6 +628,7 @@ static void __clocksource_select(bool skipcur)
break;
}

found:
if (curr_clocksource != best && !timekeeping_notify(best)) {
pr_info("Switched to clocksource %s\n", best->name);
curr_clocksource = best;
Expand Down

0 comments on commit 7f852af

Please sign in to comment.