summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2024-05-28 22:49:03 +0200
committerHans de Goede <hdegoede@redhat.com>2024-06-03 11:54:29 +0200
commit306aec7eea8c83e8212f4dd6e5b358c508e3e466 (patch)
treeaa141f29b6b7f67b504957fbcd40cd950ec6b025 /drivers
parent1981b296f858010eae409548fd297659b2cc570e (diff)
platform/x86: dell-smbios: Simplify error handling
When the allocation of value_name fails, the error handling code uses two gotos for error handling, which is not necessary. Simplify the error handling in this case by only using a single goto. Tested on a Dell Inspiron 3505. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240528204903.445546-2-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/dell/dell-smbios-base.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/platform/x86/dell/dell-smbios-base.c b/drivers/platform/x86/dell/dell-smbios-base.c
index 86b95206cb1b..b562ed99ec4e 100644
--- a/drivers/platform/x86/dell/dell-smbios-base.c
+++ b/drivers/platform/x86/dell/dell-smbios-base.c
@@ -492,19 +492,16 @@ static int build_tokens_sysfs(struct platform_device *dev)
/* add value */
value_name = kasprintf(GFP_KERNEL, "%04x_value",
da_tokens[i].tokenID);
- if (value_name == NULL)
- goto loop_fail_create_value;
+ if (!value_name) {
+ kfree(location_name);
+ goto out_unwind_strings;
+ }
sysfs_attr_init(&token_entries[i].value_attr.attr);
token_entries[i].value_attr.attr.name = value_name;
token_entries[i].value_attr.attr.mode = 0444;
token_entries[i].value_attr.show = value_show;
token_attrs[j++] = &token_entries[i].value_attr.attr;
- continue;
-
-loop_fail_create_value:
- kfree(location_name);
- goto out_unwind_strings;
}
smbios_attribute_group.attrs = token_attrs;