Browse Source

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 <l.majewski@samsung.com>
Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Lukasz Majewski 10 years ago
parent
commit
4531fa1684
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/thermal/samsung/exynos_tmu.c

+ 1 - 1
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);