Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c072fed9 authored by Sachin Kamat's avatar Sachin Kamat Committed by Zhang Rui
Browse files

thermal: Exynos: Fix NULL pointer dereference in exynos_unregister_thermal()



exynos_unregister_thermal() is functional only when 'th_zone' is not
NULL (ensured by the NULL checks). However, in the event it is NULL, it
gets dereferenced in the for loop. This patch fixes this issue.

Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
parent a4b6fec9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -475,11 +475,14 @@ static void exynos_unregister_thermal(void)
{
	int i;

	if (th_zone && th_zone->therm_dev)
	if (!th_zone)
		return;

	if (th_zone->therm_dev)
		thermal_zone_device_unregister(th_zone->therm_dev);

	for (i = 0; i < th_zone->cool_dev_size; i++) {
		if (th_zone && th_zone->cool_dev[i])
		if (th_zone->cool_dev[i])
			cpufreq_cooling_unregister(th_zone->cool_dev[i]);
	}