OSDN Git Service

clocksource: Fix 'ret' data type of sysfs_override_clocksource() and sysfs_unbind_clo...
authorElad Wexler <elad.wexler@gmail.com>
Thu, 12 Sep 2013 10:28:54 +0000 (13:28 +0300)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 17 Sep 2013 18:19:27 +0000 (11:19 -0700)
sysfs_override_clocksource(): The expression 'if (ret >= 0)' is always true.
This will cause clocksource_select() to always run.
Thus modified ret to be of type ssize_t.

sysfs_unbind_clocksource(): The expression 'if (ret < 0)' is always false.
So in case sysfs_get_uname() failed, the expression won't take an effect.
Thus modified ret to be of type ssize_t.

Signed-off-by: Elad Wexler <elad.wexler@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
kernel/time/clocksource.c

index 64cf63c..c9317e1 100644 (file)
@@ -940,7 +940,7 @@ static ssize_t sysfs_override_clocksource(struct device *dev,
                                          struct device_attribute *attr,
                                          const char *buf, size_t count)
 {
-       size_t ret;
+       ssize_t ret;
 
        mutex_lock(&clocksource_mutex);
 
@@ -968,7 +968,7 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev,
 {
        struct clocksource *cs;
        char name[CS_NAME_LEN];
-       size_t ret;
+       ssize_t ret;
 
        ret = sysfs_get_uname(buf, name, count);
        if (ret < 0)