btrfs: add a check for sysfs_create_group
PATCH v2 1/1 btrfs: add a check for sysfs_create_group
In case sysfs_create_group fails, let's check its return value and issues an error message.
--- fs/btrfs/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/sysfs.c +2 -0
@@ -889,6 +889,8 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,*/ sysfs_remove_group (fsid_kobj, &btrfs_feature_attr_group); ret =sysfs_create_group (fsid_kobj, &btrfs_feature_attr_group); +if (ret) +btrfs_err (fs_info,"failed to create btrfs_feature_attr_group.\n" ); }static int btrfs_init_debugfs (void )
Signature · 1 line
2.17.2 (Apple Git-113)
Quoted 13 lines · Kangjie Lu
In case
sysfs_create_groupfails, let's check its return value and issues an error message.Signed-off-by Kangjie Lu <[email protected]>--- fs/btrfs/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)fs/btrfs/sysfs.c +0
-0
fs/btrfs/sysfs.c void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, · line 893
Quoted 5 lines
fs/btrfs/sysfs.c +2
-0@@ -889,6 +889,8 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,*/ sysfs_remove_group (fsid_kobj, &btrfs_feature_attr_group); ret =sysfs_create_group (fsid_kobj, &btrfs_feature_attr_group); +if (ret) +btrfs_err (fs_info,"failed to create btrfs_feature_attr_group.\n" );
NIT: ".\n" is unnecessary.
---
Su
Quoted 4 lines
fs/btrfs/sysfs.c +0
-0}static int btrfs_init_debugfs (void )
Quoted 13 lines · Kangjie Lu
In case
sysfs_create_groupfails, let's check its return value and issues an error message.Signed-off-by Kangjie Lu <[email protected]>--- fs/btrfs/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)fs/btrfs/sysfs.c +0
-0
fs/btrfs/sysfs.c void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, · line 893
Quoted 5 lines
fs/btrfs/sysfs.c +2
-0@@ -889,6 +889,8 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,*/ sysfs_remove_group (fsid_kobj, &btrfs_feature_attr_group); ret =sysfs_create_group (fsid_kobj, &btrfs_feature_attr_group); +if (ret) +btrfs_err (fs_info,"failed to create btrfs_feature_attr_group.\n" );
Forgot to mention, for btrfs_* infrastructure, no need for the ending '\n'.
Despite that, looks good.
Thanks,
Qu
Quoted 4 lines
fs/btrfs/sysfs.c +0
-0}static int btrfs_init_debugfs (void )
Quoted 2 lines · Kangjie Lu
In case
sysfs_create_groupfails, let's check its return value and issues an error message.
It's in a function that's not currently used and the sysfs code needs to be reworked. The return code should be passed to the caller, printing error message in this case may not be desired but I can't say right now.