diff options
author | Dan Carpenter | 2015-04-21 04:21:53 -0500 |
---|---|---|
committer | Sasha Levin | 2016-04-11 21:44:22 -0500 |
commit | 973fc47992c915d37b1b802188bdfda1cfd2ed51 (patch) | |
tree | 37482804c566f5eff6492df6867b2ac06490d364 /drivers/firmware | |
parent | 809f952a39a2ccb9667f8b88b4ad283459b2880a (diff) | |
download | ti-linux-kernel-973fc47992c915d37b1b802188bdfda1cfd2ed51.tar.gz ti-linux-kernel-973fc47992c915d37b1b802188bdfda1cfd2ed51.tar.xz ti-linux-kernel-973fc47992c915d37b1b802188bdfda1cfd2ed51.zip |
efi: efivar_create_sysfs_entry() should return negative error codes
[ Upstream commit f7ef7e3e506023f826c1ee60b7e59b985316e180 ]
It's not very normal to return 1 on failure and 0 on success. There
isn't a reason for it here, the callers don't care so long as it's
non-zero on failure.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/efivars.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index 7b2e0496e0c0..756eca8c4cf8 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c | |||
@@ -535,7 +535,7 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | |||
535 | * efivar_create_sysfs_entry - create a new entry in sysfs | 535 | * efivar_create_sysfs_entry - create a new entry in sysfs |
536 | * @new_var: efivar entry to create | 536 | * @new_var: efivar entry to create |
537 | * | 537 | * |
538 | * Returns 1 on failure, 0 on success | 538 | * Returns 0 on success, negative error code on failure |
539 | */ | 539 | */ |
540 | static int | 540 | static int |
541 | efivar_create_sysfs_entry(struct efivar_entry *new_var) | 541 | efivar_create_sysfs_entry(struct efivar_entry *new_var) |
@@ -544,6 +544,7 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var) | |||
544 | char *short_name; | 544 | char *short_name; |
545 | unsigned long variable_name_size; | 545 | unsigned long variable_name_size; |
546 | efi_char16_t *variable_name; | 546 | efi_char16_t *variable_name; |
547 | int ret; | ||
547 | 548 | ||
548 | variable_name = new_var->var.VariableName; | 549 | variable_name = new_var->var.VariableName; |
549 | variable_name_size = ucs2_strlen(variable_name) * sizeof(efi_char16_t); | 550 | variable_name_size = ucs2_strlen(variable_name) * sizeof(efi_char16_t); |
@@ -558,7 +559,7 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var) | |||
558 | short_name = kzalloc(short_name_size, GFP_KERNEL); | 559 | short_name = kzalloc(short_name_size, GFP_KERNEL); |
559 | 560 | ||
560 | if (!short_name) | 561 | if (!short_name) |
561 | return 1; | 562 | return -ENOMEM; |
562 | 563 | ||
563 | /* Convert Unicode to normal chars (assume top bits are 0), | 564 | /* Convert Unicode to normal chars (assume top bits are 0), |
564 | ala UTF-8 */ | 565 | ala UTF-8 */ |
@@ -574,11 +575,11 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var) | |||
574 | 575 | ||
575 | new_var->kobj.kset = efivars_kset; | 576 | new_var->kobj.kset = efivars_kset; |
576 | 577 | ||
577 | i = kobject_init_and_add(&new_var->kobj, &efivar_ktype, | 578 | ret = kobject_init_and_add(&new_var->kobj, &efivar_ktype, |
578 | NULL, "%s", short_name); | 579 | NULL, "%s", short_name); |
579 | kfree(short_name); | 580 | kfree(short_name); |
580 | if (i) | 581 | if (ret) |
581 | return 1; | 582 | return ret; |
582 | 583 | ||
583 | kobject_uevent(&new_var->kobj, KOBJ_ADD); | 584 | kobject_uevent(&new_var->kobj, KOBJ_ADD); |
584 | efivar_entry_add(new_var, &efivar_sysfs_list); | 585 | efivar_entry_add(new_var, &efivar_sysfs_list); |