From: Thomas Gleixner <t...@linutronix.de>

[ Upstream commit a5cbdf693a60d5b86d4d21dfedd90f17754eb273 ]

When acpi_install_notify_handler() fails the cooling device stays
registered and the sysfs files created via acpi_pss_perf_init() are
leaked and the function returns success.

Undo acpi_pss_perf_init() and return a proper error code.

Signed-off-by: Thomas Gleixner <t...@linutronix.de>
Cc: Fenghua Yu <fenghua...@intel.com>
Cc: Tony Luck <tony.l...@intel.com>
Cc: Herbert Xu <herb...@gondor.apana.org.au>
Cc: "Rafael J. Wysocki" <r...@rjwysocki.net>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org>
Cc: Sebastian Siewior <bige...@linutronix.de>
Cc: Lai Jiangshan <jiangshan...@gmail.com>
Cc: linux-a...@vger.kernel.org
Cc: Viresh Kumar <viresh.ku...@linaro.org>
Cc: Michael Ellerman <m...@ellerman.id.au>
Cc: Tejun Heo <t...@kernel.org>
Cc: "David S. Miller" <da...@davemloft.net>
Cc: Len Brown <l...@kernel.org>
Link: http://lkml.kernel.org/r/20170412201042.695499...@linutronix.de
Signed-off-by: Thomas Gleixner <t...@linutronix.de>
Signed-off-by: Sasha Levin <alexander.le...@microsoft.com>
---
 drivers/acpi/processor_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 11154a330f07..2c086859a0bd 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -259,6 +259,9 @@ static int __acpi_processor_start(struct acpi_device 
*device)
        if (ACPI_SUCCESS(status))
                return 0;
 
+       result = -ENODEV;
+       acpi_pss_perf_exit(pr, device);
+
 err_power_exit:
        acpi_processor_power_exit(pr);
        return result;
-- 
2.14.1

Reply via email to