Commit 172066cc authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Daniel Lezcano

acpi: thermal: Fix error handling in the register function

The acpi_thermal_register_thermal_zone() is missing any error handling.
This needs to be fixed.
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200629122925.21729-2-andrzej.p@collabora.com
parent 9ebcfadb
......@@ -901,23 +901,35 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
result = sysfs_create_link(&tz->device->dev.kobj,
&tz->thermal_zone->device.kobj, "thermal_zone");
if (result)
return result;
goto unregister_tzd;
result = sysfs_create_link(&tz->thermal_zone->device.kobj,
&tz->device->dev.kobj, "device");
if (result)
return result;
goto remove_tz_link;
status = acpi_bus_attach_private_data(tz->device->handle,
tz->thermal_zone);
if (ACPI_FAILURE(status))
return -ENODEV;
if (ACPI_FAILURE(status)) {
result = -ENODEV;
goto remove_dev_link;
}
tz->tz_enabled = 1;
dev_info(&tz->device->dev, "registered as thermal_zone%d\n",
tz->thermal_zone->id);
return 0;
remove_dev_link:
sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
remove_tz_link:
sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
unregister_tzd:
thermal_zone_device_unregister(tz->thermal_zone);
return result;
}
static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment