Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[platform/kernel/linux-starfive.git] / fs / xfs / xfs_sysfs.h
index 4358585..513095e 100644 (file)
@@ -33,10 +33,15 @@ xfs_sysfs_init(
        const char              *name)
 {
        struct kobject          *parent;
+       int err;
 
        parent = parent_kobj ? &parent_kobj->kobject : NULL;
        init_completion(&kobj->complete);
-       return kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name);
+       err = kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name);
+       if (err)
+               kobject_put(&kobj->kobject);
+
+       return err;
 }
 
 static inline void