diff mbox series

[v2,3/4] btrfs: sysfs, use btrfs_sysfs_remove_fsid in fail return in add_fsid

Message ID 1581499693-22407-4-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: sysfs, add devinfo, fix devid and cleanups | expand

Commit Message

Anand Jain Feb. 12, 2020, 9:28 a.m. UTC
We have one simple function btrfs_sysfs_remove_fsid() to undo
btrfs_sysfs_add_fsid(). Which is also smart enough to check if the kobject
is initialized.

So lets use this function while retreating from the function
btrfs_sysfs_add_fsid().

One difference if btrfs_sysfs_remove_fsid() used is that, now we also call
kobject_del() which was missing before. So tested (with kobject debug
turned on) and find that there isn't any change with or without
kobject_del().

This is a cleanup patch.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2: change log updated.

 fs/btrfs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 3c10e78924d0..119edd4341d6 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1371,7 +1371,7 @@  int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
 	if (!fs_devs->devices_kobj) {
 		btrfs_err(fs_devs->fs_info,
 			  "failed to init sysfs device interface");
-		kobject_put(&fs_devs->fsid_kobj);
+		btrfs_sysfs_remove_fsid(fs_devs);
 		return -ENOMEM;
 	}