mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Cc: Theodore Ts'o <[email protected]> Cc: Al Viro <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Nick Piggin <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
7a62cc1021
commit
05cc0cee69
1 changed files with 3 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue