mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
configfs: Allow ->make_item() and ->make_group() to return detailed errors.
The configfs operations ->make_item() and ->make_group() currently return a new item/group. A return of NULL signifies an error. Because of this, -ENOMEM is the only return code bubbled up the stack. Multiple folks have requested the ability to return specific error codes when these operations fail. This patch adds that ability by changing the ->make_item/group() ops to return an int. Also updated are the in-kernel users of configfs. Signed-off-by: Joel Becker <[email protected]>
This commit is contained in:
parent
6d8344baee
commit
11c3b79218
8 changed files with 94 additions and 64 deletions
|
|
@ -1073,25 +1073,24 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
|||
group = NULL;
|
||||
item = NULL;
|
||||
if (type->ct_group_ops->make_group) {
|
||||
group = type->ct_group_ops->make_group(to_config_group(parent_item), name);
|
||||
if (group) {
|
||||
ret = type->ct_group_ops->make_group(to_config_group(parent_item), name, &group);
|
||||
if (!ret) {
|
||||
link_group(to_config_group(parent_item), group);
|
||||
item = &group->cg_item;
|
||||
}
|
||||
} else {
|
||||
item = type->ct_group_ops->make_item(to_config_group(parent_item), name);
|
||||
if (item)
|
||||
ret = type->ct_group_ops->make_item(to_config_group(parent_item), name, &item);
|
||||
if (!ret)
|
||||
link_obj(parent_item, item);
|
||||
}
|
||||
mutex_unlock(&subsys->su_mutex);
|
||||
|
||||
kfree(name);
|
||||
if (!item) {
|
||||
if (ret) {
|
||||
/*
|
||||
* If item == NULL, then link_obj() was never called.
|
||||
* If ret != 0, then link_obj() was never called.
|
||||
* There are no extra references to clean up.
|
||||
*/
|
||||
ret = -ENOMEM;
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue