aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhen Lei <[email protected]>2022-11-22 19:50:02 +0800
committerDavid Sterba <[email protected]>2022-11-23 16:52:22 +0100
commitffdbb44f2f23f963b8f5672e35c3a26088177a62 (patch)
treee15cfa4a9d073928eeeee3d8760cb5c6ec4502a9
parent796787c978efbbdb50e245718c784eb94f59eac4 (diff)
btrfs: sysfs: normalize the error handling branch in btrfs_init_sysfs()
Although kset_unregister() can eventually remove all attribute files, explicitly rolling back with the matching function makes the code logic look clearer. CC: [email protected] # 5.4+ Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Zhen Lei <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
-rw-r--r--fs/btrfs/sysfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 699b54b3acaa..74fef1f49c35 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -2321,8 +2321,11 @@ int __init btrfs_init_sysfs(void)
#ifdef CONFIG_BTRFS_DEBUG
ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_debug_feature_attr_group);
- if (ret)
- goto out2;
+ if (ret) {
+ sysfs_unmerge_group(&btrfs_kset->kobj,
+ &btrfs_static_feature_attr_group);
+ goto out_remove_group;
+ }
#endif
return 0;