From: Lukasz Majewski Date: Fri, 6 Feb 2015 13:07:10 +0000 (+0100) Subject: thermal: exynos: fix: Check if data->tmu_read callback is present before read X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4531fa1684bb883ee01f1a182900b1e15d461b34;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git thermal: exynos: fix: Check if data->tmu_read callback is present before read The exynos_tmu_data() function should on entrance test not only for valid data pointer, but also for data->tmu_read one. It is important, since afterwards it is dereferenced to get temperature code. Signed-off-by: Lukasz Majewski Tested-by: Abhilash Kesavan Signed-off-by: Zhang Rui --- diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index fbeedc072cc2..933cd80a6bc5 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -716,7 +716,7 @@ static int exynos_get_temp(void *p, long *temp) { struct exynos_tmu_data *data = p; - if (!data) + if (!data || !data->tmu_read) return -EINVAL; mutex_lock(&data->lock);