Blob Blame History Raw
From 0be86969ae385c5c944286bd9f66068525de15ee Mon Sep 17 00:00:00 2001
From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Sat, 30 Dec 2017 01:05:21 +0300
Subject: [PATCH] thermal: int3400_thermal: fix error handling in int3400_thermal_probe()
Git-commit: 0be86969ae385c5c944286bd9f66068525de15ee
Patch-mainline: v4.16-rc1
References: bsc#1051510

There are resources that are not dealocated on failure path
in int3400_thermal_probe().

Found by Linux Driver Verification project (linuxtesting.org).

[ trim down the new acpi-related code that isn't in 4.12.x -- tiwai ]

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/thermal/int340x_thermal/int3400_thermal.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/thermal/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
@@ -293,6 +293,8 @@ static int int3400_thermal_probe(struct
 	return 0;
 
 free_zone:
+	if (!priv->rel_misc_dev_res)
+		acpi_thermal_rel_misc_device_remove(priv->adev->handle);
 	thermal_zone_device_unregister(priv->thermal);
 free_art_trt:
 	kfree(priv->trts);