]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
sysfs: Fix return values for sysdev_store_{ulong,int}
authorAndi Kleen <andi@firstfloor.org>
Mon, 13 Oct 2008 10:03:03 +0000 (12:03 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 29 Oct 2008 22:03:49 +0000 (15:03 -0700)
SYSFS: Fix return values for sysdev_store_{ulong,int}

Always return the full size instead of the consumed
length of the string in sysdev_store_{ulong,int}

This avoids EINVAL errors in some echo versions.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/sys.c

index 3ca9c5e8d765cd4426ea29422dbf8e47d2ae462b..c98c31ec2f752189e2481a278ed8e7f02cf01985 100644 (file)
@@ -488,7 +488,8 @@ ssize_t sysdev_store_ulong(struct sys_device *sysdev,
        if (end == buf)
                return -EINVAL;
        *(unsigned long *)(ea->var) = new;
-       return end - buf;
+       /* Always return full write size even if we didn't consume all */
+       return size;
 }
 EXPORT_SYMBOL_GPL(sysdev_store_ulong);
 
@@ -511,7 +512,8 @@ ssize_t sysdev_store_int(struct sys_device *sysdev,
        if (end == buf || new > INT_MAX || new < INT_MIN)
                return -EINVAL;
        *(int *)(ea->var) = new;
-       return end - buf;
+       /* Always return full write size even if we didn't consume all */
+       return size;
 }
 EXPORT_SYMBOL_GPL(sysdev_store_int);