static int wbrf_record(struct acpi_device *adev, uint8_t action, struct wbrf_ranges_in_out *in)
{
union acpi_object argv4;
- union acpi_object *tmp;
- union acpi_object *obj;
u32 num_of_ranges = 0;
u32 num_of_elements;
u32 arg_idx = 0;
*/
num_of_elements = 2 * num_of_ranges + 2;
- tmp = kcalloc(num_of_elements, sizeof(*tmp), GFP_KERNEL);
+ union acpi_object *tmp __free(kfree) = kcalloc(num_of_elements, sizeof(*tmp), GFP_KERNEL);
if (!tmp)
return -ENOMEM;
tmp[arg_idx++].integer.value = in->band_list[i].end;
}
- obj = acpi_evaluate_dsm(adev->handle, &wifi_acpi_dsm_guid,
- WBRF_REVISION, WBRF_RECORD, &argv4);
+ union acpi_object *obj __free(kfree) =
+ acpi_evaluate_dsm(adev->handle, &wifi_acpi_dsm_guid,
+ WBRF_REVISION, WBRF_RECORD, &argv4);
- if (!obj) {
- kfree(tmp);
+ if (!obj)
return -EINVAL;
- }
- if (obj->type != ACPI_TYPE_INTEGER) {
- ret = -EINVAL;
- goto out;
- }
+ if (obj->type != ACPI_TYPE_INTEGER)
+ return -EINVAL;
ret = obj->integer.value;
if (ret)
- ret = -EINVAL;
-
-out:
- ACPI_FREE(obj);
- kfree(tmp);
+ return -EINVAL;
return ret;
}