Commit dd3fd8bd authored by Shen Feng's avatar Shen Feng Committed by Chris Mason

Btrfs: do not call kfree if kmalloc failed in btrfs_sysfs_add_super

Signed-off-by: default avatarShen Feng <shen@cn.fujitsu.com>
parent 1f483660
...@@ -212,14 +212,13 @@ int btrfs_sysfs_add_super(struct btrfs_fs_info *fs) ...@@ -212,14 +212,13 @@ int btrfs_sysfs_add_super(struct btrfs_fs_info *fs)
fs->super_kobj.kset = btrfs_kset; fs->super_kobj.kset = btrfs_kset;
error = kobject_init_and_add(&fs->super_kobj, &btrfs_super_ktype, error = kobject_init_and_add(&fs->super_kobj, &btrfs_super_ktype,
NULL, "%s", name); NULL, "%s", name);
kfree(name);
if (error) if (error)
goto fail; goto fail;
kfree(name);
return 0; return 0;
fail: fail:
kfree(name);
printk(KERN_ERR "btrfs: sysfs creation for super failed\n"); printk(KERN_ERR "btrfs: sysfs creation for super failed\n");
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment