[1/4] btrfs: sysfs, use btrfs_sysfs_remove_fsid in fail return in add_fsid
diff mbox series

Message ID 20191205112706.8125-2-anand.jain@oracle.com
State New
Headers show
  • btrfs, sysfs cleanup and add dev_state
Related show

Commit Message

Anand Jain Dec. 5, 2019, 11:27 a.m. UTC
We have one simple function btrfs_sysfs_remove_fsid() to cleanup
kobjects added by btrfs_sysfs_add_fsid() and calls kobject_put() and
kobject_delete() only if the kobject is initialized or not null.
So use this function while retreating in the function

One difference though, earlier we did not call kobject_del() during
retreat in btrfs_sysfs_add_fsid() and I did experiment to figureout
if that's an error or warning, however I didn't notice any such issues
with or without kobject_del() not being called.

So this patch is just for cleanup.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
 fs/btrfs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 16379f491ca1..4cda410f0e6b 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1076,7 +1076,7 @@  int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
 	if (!fs_devs->devices_kobj) {
 			  "failed to init sysfs device interface");
-		kobject_put(&fs_devs->fsid_kobj);
+		btrfs_sysfs_remove_fsid(fs_devs);
 		return -ENOMEM;