]> Git Repo - linux.git/commitdiff
platform/x86: dell-smbios: Simplify error handling
authorArmin Wolf <[email protected]>
Tue, 28 May 2024 20:49:03 +0000 (22:49 +0200)
committerHans de Goede <[email protected]>
Mon, 3 Jun 2024 09:54:29 +0000 (11:54 +0200)
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 <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Hans de Goede <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
drivers/platform/x86/dell/dell-smbios-base.c

index 86b95206cb1bd61f1ec4515608d734751620a063..b562ed99ec4e7964d83dfbbab688299be47dd839 100644 (file)
@@ -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;
 
This page took 0.059011 seconds and 4 git commands to generate.