linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: exynos: fix: Check if data->tmu_read callback is present before read
@ 2015-02-06 13:07 Lukasz Majewski
  2015-02-16  9:53 ` Lukasz Majewski
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2015-02-06 13:07 UTC (permalink / raw)
  To: Eduardo Valentin
  Cc: Zhang Rui, Linux PM list, linux-samsung-soc@vger.kernel.org,
	Bartlomiej Zolnierkiewicz, Lukasz Majewski, Abhilash Kesavan,
	Abhilash Kesavan, Chanwoo Choi, Lukasz Majewski

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>
---
 drivers/thermal/samsung/exynos_tmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 3a19353..a86e0495e 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -717,7 +717,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);
-- 
2.0.0.rc2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] thermal: exynos: fix: Check if data->tmu_read callback is present before read
  2015-02-06 13:07 [PATCH] thermal: exynos: fix: Check if data->tmu_read callback is present before read Lukasz Majewski
@ 2015-02-16  9:53 ` Lukasz Majewski
  2015-02-19 12:23   ` Abhilash Kesavan
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2015-02-16  9:53 UTC (permalink / raw)
  To: Eduardo Valentin
  Cc: Lukasz Majewski, Zhang Rui, Linux PM list,
	linux-samsung-soc@vger.kernel.org, Bartlomiej Zolnierkiewicz,
	Lukasz Majewski, Abhilash Kesavan, Abhilash Kesavan, Chanwoo Choi

Hi Eduardo,

> 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>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c index 3a19353..a86e0495e 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -717,7 +717,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);

This fix shall be added to v3.20.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] thermal: exynos: fix: Check if data->tmu_read callback is present before read
  2015-02-16  9:53 ` Lukasz Majewski
@ 2015-02-19 12:23   ` Abhilash Kesavan
  0 siblings, 0 replies; 3+ messages in thread
From: Abhilash Kesavan @ 2015-02-19 12:23 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Eduardo Valentin, Zhang Rui, Linux PM list,
	linux-samsung-soc@vger.kernel.org, Bartlomiej Zolnierkiewicz,
	Lukasz Majewski, Chanwoo Choi

Hi Lukasz,

On Mon, Feb 16, 2015 at 3:23 PM, Lukasz Majewski <l.majewski@samsung.com> wrote:
> Hi Eduardo,
>
>> 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>
>> ---
>>  drivers/thermal/samsung/exynos_tmu.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/thermal/samsung/exynos_tmu.c
>> b/drivers/thermal/samsung/exynos_tmu.c index 3a19353..a86e0495e 100644
>> --- a/drivers/thermal/samsung/exynos_tmu.c
>> +++ b/drivers/thermal/samsung/exynos_tmu.c
>> @@ -717,7 +717,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);
>
> This fix shall be added to v3.20.

Thanks for looking into this. This fixes the incorrect temperature at
boot-up I was seeing on Exynos7 and Exynos5420.

Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>

Test HW: Peach-Pit (Exynos5420 based chromebook) and Exynos7 based
Espresso board.

Regards,
Abhilash
>
> --
> Best regards,
>
> Lukasz Majewski
>
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-19 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 13:07 [PATCH] thermal: exynos: fix: Check if data->tmu_read callback is present before read Lukasz Majewski
2015-02-16  9:53 ` Lukasz Majewski
2015-02-19 12:23   ` Abhilash Kesavan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).