diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2022-03-24 20:09:49 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-04-05 20:25:21 +0200 |
commit | 9e5d3d6be66472037c4b20b7d2b43e916207ab77 (patch) | |
tree | c9580ce09061f2630b84e8d2c02b19dea112f1ee /drivers/thermal | |
parent | thermal: int340x: Clean up unnecessary acpi_buffer pointer freeing (diff) | |
download | linux-9e5d3d6be66472037c4b20b7d2b43e916207ab77.tar.xz linux-9e5d3d6be66472037c4b20b7d2b43e916207ab77.zip |
thermal: int340x: Consolidate freeing of acpi_buffer pointer
Introduce a single point of freeing/exit after ensuring no error in
int3400_setup_gddv().
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 0e7931c286ec..e299873d50b8 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -508,21 +508,18 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv) obj = buffer.pointer; if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 1 - || obj->package.elements[0].type != ACPI_TYPE_BUFFER) { - kfree(buffer.pointer); - return; - } + || obj->package.elements[0].type != ACPI_TYPE_BUFFER) + goto out_free; priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer, obj->package.elements[0].buffer.length, GFP_KERNEL); - if (!priv->data_vault) { - kfree(buffer.pointer); - return; - } + if (!priv->data_vault) + goto out_free; bin_attr_data_vault.private = priv->data_vault; bin_attr_data_vault.size = obj->package.elements[0].buffer.length; +out_free: kfree(buffer.pointer); } |