summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2017-12-30 01:05:21 +0300
committerZhang Rui <rui.zhang@intel.com>2018-01-13 21:19:25 +0800
commit0be86969ae385c5c944286bd9f66068525de15ee (patch)
tree1a9e9093d4d5f4c3cbb3b4e60fb7a5ee40f81a5f /drivers/thermal
parent261ac1d2d9ef9a29c57f8aff341ae3dc323a707c (diff)
downloadlinux-0be86969ae385c5c944286bd9f66068525de15ee.tar.bz2
thermal: int3400_thermal: fix error handling in int3400_thermal_probe()
There are resources that are not dealocated on failure path in int3400_thermal_probe(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/int340x_thermal/int3400_thermal.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c
index c9db1c643501..e26b01c05e82 100644
--- a/drivers/thermal/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
@@ -319,17 +319,21 @@ static int int3400_thermal_probe(struct platform_device *pdev)
result = sysfs_create_group(&pdev->dev.kobj, &uuid_attribute_group);
if (result)
- goto free_zone;
+ goto free_rel_misc;
result = acpi_install_notify_handler(
priv->adev->handle, ACPI_DEVICE_NOTIFY, int3400_notify,
(void *)priv);
if (result)
- goto free_zone;
+ goto free_sysfs;
return 0;
-free_zone:
+free_sysfs:
+ sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
+free_rel_misc:
+ 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);