Commit 3116aabc authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

efivars: handle errors from register_efivars()

We should unwind and return an error if register_efivars() fails.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarMike Waychison <mikew@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 051d51bc
......@@ -803,6 +803,8 @@ efivars_init(void)
ops.set_variable = efi.set_variable;
ops.get_next_variable = efi.get_next_variable;
error = register_efivars(&__efivars, &ops, efi_kobj);
if (error)
goto err_put;
/* Don't forget the systab entry */
error = sysfs_create_group(efi_kobj, &efi_subsys_attr_group);
......@@ -810,10 +812,15 @@ efivars_init(void)
printk(KERN_ERR
"efivars: Sysfs attribute export failed with error %d.\n",
error);
unregister_efivars(&__efivars);
kobject_put(efi_kobj);
goto err_unregister;
}
return 0;
err_unregister:
unregister_efivars(&__efivars);
err_put:
kobject_put(efi_kobj);
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