Skip to content

Commit ffdbb44

Browse files
Zhen Leikdave
authored andcommitted
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]>
1 parent 796787c commit ffdbb44

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/btrfs/sysfs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,8 +2321,11 @@ int __init btrfs_init_sysfs(void)
23212321

23222322
#ifdef CONFIG_BTRFS_DEBUG
23232323
ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_debug_feature_attr_group);
2324-
if (ret)
2325-
goto out2;
2324+
if (ret) {
2325+
sysfs_unmerge_group(&btrfs_kset->kobj,
2326+
&btrfs_static_feature_attr_group);
2327+
goto out_remove_group;
2328+
}
23262329
#endif
23272330

23282331
return 0;

0 commit comments

Comments
 (0)