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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
v2: change log updated.

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

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;
 	}
 
-- 
1.8.3.1




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux