diff options
| author | Zhen Lei <thunder.leizhen@huawei.com> | 2022-11-22 19:50:02 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-02 17:41:12 +0100 |
| commit | b8dc245909238dd665f1411a9f8d37851d7ff687 (patch) | |
| tree | f5ecd6c5ca67e82c639895b19eea1f47cea9d5ab | |
| parent | 914baca57af7b9650686d73dbe6c1949c174fa12 (diff) | |
| download | linux-b8dc245909238dd665f1411a9f8d37851d7ff687.tar.gz linux-b8dc245909238dd665f1411a9f8d37851d7ff687.tar.bz2 linux-b8dc245909238dd665f1411a9f8d37851d7ff687.zip | |
btrfs: sysfs: normalize the error handling branch in btrfs_init_sysfs()
commit ffdbb44f2f23f963b8f5672e35c3a26088177a62 upstream.
Although kset_unregister() can eventually remove all attribute files,
explicitly rolling back with the matching function makes the code logic
look clearer.
CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | fs/btrfs/sysfs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 25a6f587852b..1c40e5151321 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -2035,8 +2035,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; |
