summaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-03-18 10:12:38 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-19 16:45:50 -0700
commit3116aabc81ccfeeb73f183ed8b1e3031520d1e59 (patch)
tree41ec771991e0ad3d074be01a6b5e3da46b51721e /drivers/firmware
parent051d51bc6a867d9466a975e4d7ca51b21a9c2c4e (diff)
efivars: handle errors from register_efivars()
We should unwind and return an error if register_efivars() fails. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Mike Waychison <mikew@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efivars.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index ff2fe4095228..5d1ec6898e7c 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -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;
}