Revert "ACPI: processor: Fix memory leaks in error paths of processor_add()"

This reverts commit bf6acb113e.
This commit is contained in:
Ksawlii 2024-11-24 00:23:37 +01:00
parent dd167a1c23
commit 7f9358fa8c

View file

@ -387,7 +387,7 @@ static int acpi_processor_add(struct acpi_device *device,
result = acpi_processor_get_info(device);
if (result) /* Processor is not physically present or unavailable */
goto err_clear_driver_data;
return result;
BUG_ON(pr->id >= nr_cpu_ids);
@ -402,7 +402,7 @@ static int acpi_processor_add(struct acpi_device *device,
"BIOS reported wrong ACPI id %d for the processor\n",
pr->id);
/* Give up, but do not abort the namespace scan. */
goto err_clear_driver_data;
goto err;
}
/*
* processor_device_array is not cleared on errors to allow buggy BIOS
@ -414,12 +414,12 @@ static int acpi_processor_add(struct acpi_device *device,
dev = get_cpu_device(pr->id);
if (!dev) {
result = -ENODEV;
goto err_clear_per_cpu;
goto err;
}
result = acpi_bind_one(dev, device);
if (result)
goto err_clear_per_cpu;
goto err;
pr->dev = dev;
@ -430,11 +430,10 @@ static int acpi_processor_add(struct acpi_device *device,
dev_err(dev, "Processor driver could not be attached\n");
acpi_unbind_one(dev);
err_clear_per_cpu:
per_cpu(processors, pr->id) = NULL;
err_clear_driver_data:
device->driver_data = NULL;
err:
free_cpumask_var(pr->throttling.shared_cpu_map);
device->driver_data = NULL;
per_cpu(processors, pr->id) = NULL;
err_free_pr:
kfree(pr);
return result;