Return value name unifications
David Sterba
maintainercover Return value name unifications
Use 'ret' instead of 'error'.
David Sterba (5):
btrfs: rename error to ret in btrfs_may_delete()
btrfs: rename error to ret in btrfs_mksubvol()
btrfs: rename error to ret in btrfs_sysfs_add_fsid()
btrfs: rename error to ret in btrfs_sysfs_add_mounted()
btrfs: rename error to ret in device_list_add()
fs/btrfs/ioctl.c | 35 ++++++++++++++-------------- fs/btrfs/sysfs.c | 57 +++++++++++++++++++++++----------------------- fs/btrfs/volumes.c | 10 ++++---- 3 files changed, 50 insertions(+), 52 deletions(-)
Signature · 1 line
2.49.0
David Sterba
maintainerPATCH 1/5 btrfs: rename error to ret in btrfs_may_delete()
Unify naming of return value to the preferred way.
--- fs/btrfs/ioctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/ioctl.c +4 -4
@@ -841,7 +841,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,static int btrfs_may_delete (struct mnt_idmap *idmap,struct inode *dir,struct dentry *victim,int isdir) { -int error; +int ret;if (d_really_is_negative (victim))return -ENOENT ;
@@ -851,9 +851,9 @@ static int btrfs_may_delete(struct mnt_idmap *idmap,return -EINVAL ;audit_inode_child (dir, victim,AUDIT_TYPE_CHILD_DELETE ); - error =inode_permission (idmap, dir,MAY_WRITE |MAY_EXEC ); -if (error) -return error; + ret =inode_permission (idmap, dir,MAY_WRITE |MAY_EXEC ); +if (ret) +return ret;if (IS_APPEND (dir))return -EPERM ; if (check_sticky(idmap, dir, d_inode(victim)) ||
Signature · 1 line
2.49.0
David Sterba
maintainerPATCH 2/5 btrfs: rename error to ret in btrfs_mksubvol()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/ioctl.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
fs/btrfs/ioctl.c +13 -14
@@ -903,28 +903,27 @@ static noinline int btrfs_mksubvol(const struct path *parent,struct btrfs_fs_info *fs_info =inode_to_fs_info (dir);struct dentry *dentry;struct fscrypt_str name_str =FSTR_INIT ((char *)name, namelen); -int error; +int ret; - error =down_write_killable_nested (&dir->i_rwsem,I_MUTEX_PARENT ); -if (error == -EINTR ) -return error; + ret =down_write_killable_nested (&dir->i_rwsem,I_MUTEX_PARENT ); +if (ret == -EINTR ) +return ret; dentry =lookup_one (idmap, &QSTR_LEN (name, namelen), parent->dentry); - error =PTR_ERR (dentry); + ret =PTR_ERR (dentry);if (IS_ERR (dentry)) goto out_unlock; - error =btrfs_may_create (idmap, dir, dentry); -if (error) + ret =btrfs_may_create (idmap, dir, dentry); +if (ret) goto out_dput;/* * even if this name doesn't exist, we may get hash collisions. * check for them now when we can safely fail */ - error =btrfs_check_dir_item_collision (BTRFS_I (dir)->root, - dir->i_ino, &name_str); -if (error) + ret =btrfs_check_dir_item_collision (BTRFS_I (dir)->root, dir->i_ino, &name_str); +if (ret) goto out_dput;down_read (&fs_info->subvol_sem);
@@ -933,11 +932,11 @@ static noinline int btrfs_mksubvol(const struct path *parent, goto out_up_read;if (snap_src) - error =create_snapshot (snap_src, dir, dentry, readonly, inherit); + ret =create_snapshot (snap_src, dir, dentry, readonly, inherit);else - error =create_subvol (idmap, dir, dentry, inherit); + ret =create_subvol (idmap, dir, dentry, inherit); -if (!error) +if (!ret)fsnotify_mkdir (dir, dentry); out_up_read:up_read (&fs_info->subvol_sem);
@@ -945,7 +944,7 @@ static noinline int btrfs_mksubvol(const struct path *parent,dput (dentry); out_unlock:btrfs_inode_unlock (BTRFS_I (dir),0 ); -return error; +return ret; } static noinline int btrfs_mksnapshot(const struct path *parent,
Signature · 1 line
2.49.0
David Sterba
maintainerPATCH 3/5 btrfs: rename error to ret in btrfs_sysfs_add_fsid()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/sysfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/sysfs.c +5 -5
@@ -2290,15 +2290,15 @@ static struct kset *btrfs_kset;*/ int btrfs_sysfs_add_fsid (struct btrfs_fs_devices *fs_devs) { -int error; +int ret;init_completion (&fs_devs->kobj_unregister); fs_devs->fsid_kobj.kset = btrfs_kset; - error =kobject_init_and_add (&fs_devs->fsid_kobj, &btrfs_ktype,NULL , -"%pU" , fs_devs->fsid); -if (error) { + ret =kobject_init_and_add (&fs_devs->fsid_kobj, &btrfs_ktype,NULL , +"%pU" , fs_devs->fsid); +if (ret) {kobject_put (&fs_devs->fsid_kobj); -return error; +return ret; } fs_devs->devices_kobj = kobject_create_and_add("devices",
Signature · 1 line
2.49.0
David Sterba
maintainerPATCH 4/5 btrfs: rename error to ret in btrfs_sysfs_add_mounted()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/sysfs.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-)
fs/btrfs/sysfs.c +23 -24
@@ -2324,71 +2324,70 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)int btrfs_sysfs_add_mounted (struct btrfs_fs_info *fs_info) { -int error; +int ret;struct btrfs_fs_devices *fs_devs = fs_info->fs_devices;struct kobject *fsid_kobj = &fs_devs->fsid_kobj; - error =btrfs_sysfs_add_fs_devices (fs_devs); -if (error) -return error; + ret =btrfs_sysfs_add_fs_devices (fs_devs); +if (ret) +return ret; - error =sysfs_create_files (fsid_kobj, btrfs_attrs); -if (error) { + ret =sysfs_create_files (fsid_kobj, btrfs_attrs); +if (ret) {btrfs_sysfs_remove_fs_devices (fs_devs); -return error; +return ret; } - error =sysfs_create_group (fsid_kobj, - &btrfs_feature_attr_group); -if (error) + ret =sysfs_create_group (fsid_kobj, &btrfs_feature_attr_group); +if (ret) goto failure;#ifdef CONFIG_BTRFS_DEBUG fs_info->debug_kobj =kobject_create_and_add ("debug" , fsid_kobj);if (!fs_info->debug_kobj) { - error = -ENOMEM ; + ret = -ENOMEM ; goto failure; } - error =sysfs_create_files (fs_info->debug_kobj, btrfs_debug_mount_attrs); -if (error) + ret =sysfs_create_files (fs_info->debug_kobj, btrfs_debug_mount_attrs); +if (ret) goto failure;#endif /* Discard directory */ fs_info->discard_kobj =kobject_create_and_add ("discard" , fsid_kobj);if (!fs_info->discard_kobj) { - error = -ENOMEM ; + ret = -ENOMEM ; goto failure; } - error =sysfs_create_files (fs_info->discard_kobj, discard_attrs); -if (error) + ret =sysfs_create_files (fs_info->discard_kobj, discard_attrs); +if (ret) goto failure; - error =addrm_unknown_feature_attrs (fs_info, true); -if (error) + ret =addrm_unknown_feature_attrs (fs_info, true); +if (ret) goto failure; - error =sysfs_create_link (fsid_kobj, &fs_info->sb->s_bdi->dev->kobj,"bdi" ); -if (error) + ret =sysfs_create_link (fsid_kobj, &fs_info->sb->s_bdi->dev->kobj,"bdi" ); +if (ret) goto failure; fs_info->space_info_kobj =kobject_create_and_add ("allocation" , fsid_kobj);if (!fs_info->space_info_kobj) { - error = -ENOMEM ; + ret = -ENOMEM ; goto failure; } - error =sysfs_create_files (fs_info->space_info_kobj, allocation_attrs); -if (error) + ret =sysfs_create_files (fs_info->space_info_kobj, allocation_attrs); +if (ret) goto failure;return 0 ; failure:btrfs_sysfs_remove_mounted (fs_info); -return error; +return ret; } static ssize_t qgroup_enabled_show(struct kobject *qgroups_kobj,
Signature · 1 line
2.49.0
David Sterba
maintainerPATCH 5/5 btrfs: rename error to ret in device_list_add()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/volumes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/volumes.c +5 -5
@@ -787,7 +787,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,u64 found_transid =btrfs_super_generation (disk_super);u64 devid =btrfs_stack_device_id (&disk_super->dev_item);dev_t path_devt; -int error; +int ret;bool same_fsid_diff_dev = false;bool has_metadata_uuid = (btrfs_super_incompat_flags (disk_super) &BTRFS_FEATURE_INCOMPAT_METADATA_UUID );
@@ -799,11 +799,11 @@ static noinline struct btrfs_device *device_list_add(const char *path,return ERR_PTR (-EAGAIN ); } - error =lookup_bdev (path, &path_devt); -if (error) { + ret =lookup_bdev (path, &path_devt); +if (ret) {btrfs_err (NULL ,"failed to lookup block device for path %s: %d" , - path, error); -return ERR_PTR (error); + path, ret); +return ERR_PTR (ret); } fs_devices =find_fsid_by_device (disk_super, path_devt, &same_fsid_diff_dev);
Signature · 1 line
2.49.0
Quoted 9 lines · David Sterba
Use 'ret' instead of 'error'.
David Sterba (5):
btrfs: rename error to ret inbtrfs_may_delete()
btrfs: rename error to ret inbtrfs_mksubvol()
btrfs: rename error to ret inbtrfs_sysfs_add_fsid()
btrfs: rename error to ret inbtrfs_sysfs_add_mounted()
btrfs: rename error to ret indevice_list_add()
The series LGTM.
Quoted 9 lines
fs/btrfs/ioctl.c | 35 ++++++++++++++-------------- fs/btrfs/sysfs.c | 57 +++++++++++++++++++++++----------------------- fs/btrfs/volumes.c | 10 ++++---- 3 files changed, 50 insertions(+), 52 deletions(-)--
2.49.0