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>
This commit is contained in:
Davidlohr Bueso 2022-03-24 12:09:49 -07:00 коммит произвёл Rafael J. Wysocki
Родитель bdff938d04
Коммит 9e5d3d6be6
1 изменённых файлов: 5 добавлений и 8 удалений

Просмотреть файл

@ -508,21 +508,18 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv)
obj = buffer.pointer; obj = buffer.pointer;
if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 1 if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 1
|| obj->package.elements[0].type != ACPI_TYPE_BUFFER) { || obj->package.elements[0].type != ACPI_TYPE_BUFFER)
kfree(buffer.pointer); goto out_free;
return;
}
priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer, priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer,
obj->package.elements[0].buffer.length, obj->package.elements[0].buffer.length,
GFP_KERNEL); GFP_KERNEL);
if (!priv->data_vault) { if (!priv->data_vault)
kfree(buffer.pointer); goto out_free;
return;
}
bin_attr_data_vault.private = priv->data_vault; bin_attr_data_vault.private = priv->data_vault;
bin_attr_data_vault.size = obj->package.elements[0].buffer.length; bin_attr_data_vault.size = obj->package.elements[0].buffer.length;
out_free:
kfree(buffer.pointer); kfree(buffer.pointer);
} }