summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2013-05-17 11:52:02 +0000
committerZhang Rui <rui.zhang@intel.com>2013-05-28 10:04:22 +0800
commit42a5bf507d7f7ecbf606eb392dd9d2e4d009c36b (patch)
tree6c8fc95ce2004bdd0e0692110a09b4a023624893 /drivers/thermal
parent3db46c939677e32e311d354b619fd552ceafd123 (diff)
downloadlinux-42a5bf507d7f7ecbf606eb392dd9d2e4d009c36b.tar.gz
linux-42a5bf507d7f7ecbf606eb392dd9d2e4d009c36b.tar.bz2
linux-42a5bf507d7f7ecbf606eb392dd9d2e4d009c36b.zip
thermal: cut the spaces when user sets policy
Setting policy results in invalid value error. % echo "step_wise" > policy % echo: write error: Invalid argument Need clean up of the buffer which "echo" may add based on the arguments, before comparing aganist list of governor names. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Tested-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d755440791b7..1067fb0107b9 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -33,6 +33,7 @@
#include <linux/idr.h>
#include <linux/thermal.h>
#include <linux/reboot.h>
+#include <linux/string.h>
#include <net/netlink.h>
#include <net/genetlink.h>
@@ -713,10 +714,13 @@ policy_store(struct device *dev, struct device_attribute *attr,
int ret = -EINVAL;
struct thermal_zone_device *tz = to_thermal_zone(dev);
struct thermal_governor *gov;
+ char name[THERMAL_NAME_LENGTH];
+
+ snprintf(name, sizeof(name), "%s", buf);
mutex_lock(&thermal_governor_lock);
- gov = __find_governor(buf);
+ gov = __find_governor(strim(name));
if (!gov)
goto exit;