cpufreq / core: Fix printing of governor and driver name
authorviresh kumar <viresh.kumar@linaro.org>
Mon, 22 Oct 2012 23:23:43 +0000 (01:23 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 14 Nov 2012 23:33:06 +0000 (00:33 +0100)
commit4b972f0b04eaae645b22d99479b9aea43c3d64e7
treeab9fd0b4ebe200738bb6836fa2e27c8db56352b2
parent8bf1ac723639c4260f76df0e45ee23aa35a23067
cpufreq / core: Fix printing of governor and driver name

Arrays for governer and driver name are of size CPUFREQ_NAME_LEN or 16.
i.e. 15 bytes for name and 1 for trailing '\0'.

When cpufreq driver print these names (for sysfs), it includes '\n' or ' ' in
the fmt string and still passes length as CPUFREQ_NAME_LEN. If the driver or
governor names are using all 15 fields allocated to them, then the trailing '\n'
or ' ' will never be printed. And so commands like:

root@linaro-developer# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver

will print something like:

cpufreq_foodrvroot@linaro-developer#

Fix this by increasing print length by one character.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h