Skip to content

Commit 17a2a72

Browse files
committed
erofs: clean up erofs_{init,exit}_sysfs()
Get rid of useless `goto`s. No logic changes. Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c36ec00 commit 17a2a72

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

fs/erofs/sysfs.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -248,31 +248,25 @@ void erofs_unregister_sysfs(struct super_block *sb)
248248
}
249249
}
250250

251+
void erofs_exit_sysfs(void)
252+
{
253+
kobject_put(&erofs_feat);
254+
kset_unregister(&erofs_root);
255+
}
256+
251257
int __init erofs_init_sysfs(void)
252258
{
253259
int ret;
254260

255261
kobject_set_name(&erofs_root.kobj, "erofs");
256262
erofs_root.kobj.parent = fs_kobj;
257263
ret = kset_register(&erofs_root);
258-
if (ret)
259-
goto root_err;
260-
261-
ret = kobject_init_and_add(&erofs_feat, &erofs_feat_ktype,
262-
NULL, "features");
263-
if (ret)
264-
goto feat_err;
265-
return ret;
266-
267-
feat_err:
268-
kobject_put(&erofs_feat);
269-
kset_unregister(&erofs_root);
270-
root_err:
264+
if (!ret) {
265+
ret = kobject_init_and_add(&erofs_feat, &erofs_feat_ktype,
266+
NULL, "features");
267+
if (!ret)
268+
return 0;
269+
erofs_exit_sysfs();
270+
}
271271
return ret;
272272
}
273-
274-
void erofs_exit_sysfs(void)
275-
{
276-
kobject_put(&erofs_feat);
277-
kset_unregister(&erofs_root);
278-
}

0 commit comments

Comments
 (0)