From: Daniel Lezcano Date: Mon, 3 Oct 2022 13:29:43 +0000 (+0200) Subject: thermal/drivers/exynos: Fix NULL pointer dereference when getting the critical temp X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a1c306375b0638f37996bbda1e3a75c6f108a097;p=linux.git thermal/drivers/exynos: Fix NULL pointer dereference when getting the critical temp The driver is assuming the get_critical temperature exists as it is inherited by the thermal of ops. But this one has been removed in favor of the generic one. Use the generic thermal_zone_get_crit_temp() function instead Fixes: 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp(") Reported-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski Tested-by: Marek Szyprowski Signed-off-by: Daniel Lezcano --- diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 5a1ffe2f31346..37465af59262b 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -264,9 +264,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev) unsigned int status; int ret = 0, temp; - if (data->soc != SOC_ARCH_EXYNOS5433) /* FIXME */ - ret = tzd->ops->get_crit_temp(tzd, &temp); - if (ret) { + ret = thermal_zone_get_crit_temp(tzd, &temp); + if (ret && data->soc != SOC_ARCH_EXYNOS5433) { /* FIXME */ dev_err(&pdev->dev, "No CRITICAL trip point defined in device tree!\n"); goto out;