From: Wu Fengguang Date: Fri, 18 Sep 2009 20:06:03 +0000 (-0700) Subject: libfs: return error code on failed attr set X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=05cc0cee6948fc11985d11557fb130645a7f69a6;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git libfs: return error code on failed attr set Currently all simple_attr.set handlers return 0 on success and negative codes on error. Fix simple_attr_write() to return these error codes. Signed-off-by: Wu Fengguang Cc: Theodore Ts'o Cc: Al Viro Cc: Christoph Hellwig Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Al Viro --- diff --git a/fs/libfs.c b/fs/libfs.c index 662a28e4f667..219576c52d80 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -739,10 +739,11 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, if (copy_from_user(attr->set_buf, buf, size)) goto out; - ret = len; /* claim we got the whole input */ attr->set_buf[size] = '\0'; val = simple_strtol(attr->set_buf, NULL, 0); - attr->set(attr->data, val); + ret = attr->set(attr->data, val); + if (ret == 0) + ret = len; /* on success, claim we got the whole input */ out: mutex_unlock(&attr->mutex); return ret;