diff options
author | Nishanth Menon <nm@ti.com> | 2012-10-26 01:50:43 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-15 00:35:05 +0100 |
commit | 12e26265e6225bf93b2fdc70399774b31e2dd980 (patch) | |
tree | 623fba6c1690ab23f8aeed388be9dfb3506ef07e /drivers/devfreq | |
parent | c5b4a1c15da3e6f472c6ff1a085a1134d18a1464 (diff) |
PM / devfreq: fix sscanf handling for writable sysfs entries
sscanf returns 0 when an invalid parameter like:
echo -n "a">min_freq
is attempted. Returning back the return result(0) will
cause the command not to return back to command
prompt.
Instead, just return -EINVAL when sscanf does not
return 1.
This is done for min_freq, max_freq and polling_interval
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r-- | drivers/devfreq/devfreq.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index a42f69b34eb2..79a7343c28a6 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -496,12 +496,11 @@ static ssize_t store_polling_interval(struct device *dev, ret = sscanf(buf, "%u", &value); if (ret != 1) - goto out; + return -EINVAL; df->governor->event_handler(df, DEVFREQ_GOV_INTERVAL, &value); ret = count; -out: return ret; } @@ -515,7 +514,7 @@ static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr, ret = sscanf(buf, "%lu", &value); if (ret != 1) - goto out; + return -EINVAL; mutex_lock(&df->lock); max = df->max_freq; @@ -529,7 +528,6 @@ static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr, ret = count; unlock: mutex_unlock(&df->lock); -out: return ret; } @@ -549,7 +547,7 @@ static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr, ret = sscanf(buf, "%lu", &value); if (ret != 1) - goto out; + return -EINVAL; mutex_lock(&df->lock); min = df->min_freq; @@ -563,7 +561,6 @@ static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr, ret = count; unlock: mutex_unlock(&df->lock); -out: return ret; } |