Skip to content

Commit

Permalink
cpufreq: Fix and clean up show_cpuinfo_cur_freq()
Browse files Browse the repository at this point in the history
commit 9b4f603 upstream.

There is a missing newline in show_cpuinfo_cur_freq(), so add it,
but while at it clean that function up somewhat too.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Rafael J. Wysocki authored and Greg Kroah-Hartman committed Mar 26, 2017
1 parent b76d4fb commit bb8c61a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,11 @@ static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy,
char *buf)
{
unsigned int cur_freq = __cpufreq_get(policy);
if (!cur_freq)
return sprintf(buf, "<unknown>");
return sprintf(buf, "%u\n", cur_freq);

if (cur_freq)
return sprintf(buf, "%u\n", cur_freq);

return sprintf(buf, "<unknown>\n");
}

/**
Expand Down

0 comments on commit bb8c61a

Please sign in to comment.