cpufreq: Fix and clean up show_cpuinfo_cur_freq()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 14 Mar 2017 23:12:16 +0000 (00:12 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 15 Mar 2017 23:12:40 +0000 (00:12 +0100)
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>
Cc: All applicable <stable@vger.kernel.org>
drivers/cpufreq/cpufreq.c

index 38b9fdf..b8ff617 100644 (file)
@@ -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");
 }
 
 /**