linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c
@ 2012-09-27  6:38 Durgadoss R
       [not found] ` <CA+icZUXV21BqzAHwPy5gY_VHEws8hXZ8B=vESuPazpmOSQVHvA@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Durgadoss R @ 2012-09-27  6:38 UTC (permalink / raw)
  To: lenb, rui.zhang; +Cc: linux-acpi, dan.carpenter, hughd, linux-next, Durgadoss R

This patch fixes the following mutex and NULL pointer
problems in thermal_sys.c:
 * mutex_unlock fix in update_temperature function
 * mutex_unlock fix in bind_cdev function
 * NULL check fix in bind_tz function

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
---
v2:
 * Removed unnecessary NULL check in bind_cdev
 * Added 'Reported-by' tags for Sedat and Hugh
 drivers/thermal/thermal_sys.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 4f77d89..e1179d3 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -253,7 +253,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
 
 		tzp = pos->tzp;
 		if (!tzp->tbp)
-			return;
+			continue;
 
 		for (i = 0; i < tzp->num_tbps; i++) {
 			if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
@@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_device *tz)
 		goto exit;
 	}
 
-	if (!tzp->tbp)
+	if (!tzp || !tzp->tbp)
 		goto exit;
 
 	list_for_each_entry(pos, &thermal_cdev_list, node) {
@@ -390,12 +390,13 @@ static void update_temperature(struct thermal_zone_device *tz)
 	ret = tz->ops->get_temp(tz, &temp);
 	if (ret) {
 		pr_warn("failed to read out thermal zone %d\n", tz->id);
-		return;
+		goto exit;
 	}
 
 	tz->last_temperature = tz->temperature;
 	tz->temperature = temp;
 
+exit:
 	mutex_unlock(&tz->lock);
 }
 
-- 
1.7.9.5

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

* Re: [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c
       [not found] ` <CA+icZUXV21BqzAHwPy5gY_VHEws8hXZ8B=vESuPazpmOSQVHvA@mail.gmail.com>
@ 2012-09-27 12:38   ` Sedat Dilek
  2012-09-27 14:05     ` Sedat Dilek
  0 siblings, 1 reply; 6+ messages in thread
From: Sedat Dilek @ 2012-09-27 12:38 UTC (permalink / raw)
  To: Durgadoss R; +Cc: lenb, rui.zhang, linux-acpi, dan.carpenter, hughd, linux-next

On Thu, Sep 27, 2012 at 10:01 AM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Thu, Sep 27, 2012 at 8:38 AM, Durgadoss R <durgadoss.r@intel.com> wrote:
>> This patch fixes the following mutex and NULL pointer
>> problems in thermal_sys.c:
>>  * mutex_unlock fix in update_temperature function
>>  * mutex_unlock fix in bind_cdev function
>>  * NULL check fix in bind_tz function
>>
>> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
>> Reported-by: Hugh Dickins <hughd@google.com>
>> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
>> ---
>> v2:
>>  * Removed unnecessary NULL check in bind_cdev
>>  * Added 'Reported-by' tags for Sedat and Hugh
>>  drivers/thermal/thermal_sys.c |    7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
>> index 4f77d89..e1179d3 100644
>> --- a/drivers/thermal/thermal_sys.c
>> +++ b/drivers/thermal/thermal_sys.c
>> @@ -253,7 +253,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
>>
>>                 tzp = pos->tzp;
>>                 if (!tzp->tbp)
>> -                       return;
>> +                       continue;
>>
>>                 for (i = 0; i < tzp->num_tbps; i++) {
>>                         if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
>> @@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_device *tz)
>>                 goto exit;
>>         }
>>
>> -       if (!tzp->tbp)
>> +       if (!tzp || !tzp->tbp)
>>                 goto exit;
>>
>>         list_for_each_entry(pos, &thermal_cdev_list, node) {
>> @@ -390,12 +390,13 @@ static void update_temperature(struct thermal_zone_device *tz)
>>         ret = tz->ops->get_temp(tz, &temp);
>>         if (ret) {
>>                 pr_warn("failed to read out thermal zone %d\n", tz->id);
>> -               return;
>> +               goto exit;
>>         }
>>
>>         tz->last_temperature = tz->temperature;
>>         tz->temperature = temp;
>>
>> +exit:
>>         mutex_unlock(&tz->lock);
>>  }
>>
>> --
>> 1.7.9.5
>>
>
> The v2 patch does *not* fix the issue here!
>
> [1] https://patchwork.kernel.org/patch/1511961/
>

I have re-tested with Linux-Next (next-20120927) plus thermal-next [1]
pulled in and see still the same call-trace!

Hugh or Dan can you confirm this works for you or not?
Thanks in advance.

[1] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=shortlog;h=refs/heads/next
[2] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=commitdiff;h=404b134156bd9d9bc506c0974a1254806e13db2c

>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-next" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c
  2012-09-27 12:38   ` Sedat Dilek
@ 2012-09-27 14:05     ` Sedat Dilek
  2012-09-27 23:48       ` Hugh Dickins
  0 siblings, 1 reply; 6+ messages in thread
From: Sedat Dilek @ 2012-09-27 14:05 UTC (permalink / raw)
  To: Durgadoss R; +Cc: lenb, rui.zhang, linux-acpi, dan.carpenter, hughd, linux-next

[-- Attachment #1: Type: text/plain, Size: 3078 bytes --]

On Thu, Sep 27, 2012 at 2:38 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Thu, Sep 27, 2012 at 10:01 AM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
>> On Thu, Sep 27, 2012 at 8:38 AM, Durgadoss R <durgadoss.r@intel.com> wrote:
>>> This patch fixes the following mutex and NULL pointer
>>> problems in thermal_sys.c:
>>>  * mutex_unlock fix in update_temperature function
>>>  * mutex_unlock fix in bind_cdev function
>>>  * NULL check fix in bind_tz function
>>>
>>> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
>>> Reported-by: Hugh Dickins <hughd@google.com>
>>> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
>>> ---
>>> v2:
>>>  * Removed unnecessary NULL check in bind_cdev
>>>  * Added 'Reported-by' tags for Sedat and Hugh
>>>  drivers/thermal/thermal_sys.c |    7 ++++---
>>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
>>> index 4f77d89..e1179d3 100644
>>> --- a/drivers/thermal/thermal_sys.c
>>> +++ b/drivers/thermal/thermal_sys.c
>>> @@ -253,7 +253,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
>>>
>>>                 tzp = pos->tzp;
>>>                 if (!tzp->tbp)
>>> -                       return;
>>> +                       continue;
>>>
>>>                 for (i = 0; i < tzp->num_tbps; i++) {
>>>                         if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
>>> @@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_device *tz)
>>>                 goto exit;
>>>         }
>>>
>>> -       if (!tzp->tbp)
>>> +       if (!tzp || !tzp->tbp)
>>>                 goto exit;
>>>
>>>         list_for_each_entry(pos, &thermal_cdev_list, node) {
>>> @@ -390,12 +390,13 @@ static void update_temperature(struct thermal_zone_device *tz)
>>>         ret = tz->ops->get_temp(tz, &temp);
>>>         if (ret) {
>>>                 pr_warn("failed to read out thermal zone %d\n", tz->id);
>>> -               return;
>>> +               goto exit;
>>>         }
>>>
>>>         tz->last_temperature = tz->temperature;
>>>         tz->temperature = temp;
>>>
>>> +exit:
>>>         mutex_unlock(&tz->lock);
>>>  }
>>>
>>> --
>>> 1.7.9.5
>>>
>>
>> The v2 patch does *not* fix the issue here!
>>
>> [1] https://patchwork.kernel.org/patch/1511961/
>>
>
> I have re-tested with Linux-Next (next-20120927) plus thermal-next [1]
> pulled in and see still the same call-trace!
>
> Hugh or Dan can you confirm this works for you or not?
> Thanks in advance.
>
> [1] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=shortlog;h=refs/heads/next
> [2] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=commitdiff;h=404b134156bd9d9bc506c0974a1254806e13db2c
>

With the attached fixup/followup patch, I can boot into my system!
But, as said yesterday... working within X, Firefox is a pain in the a**.

- Sedat -

>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-next" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: 0001-Thermal-Fixup-to-commit-404b134156bd-Fix-synchroniza.patch --]
[-- Type: application/octet-stream, Size: 797 bytes --]

From 26b88617505acb59d93884199de9c6a94d306ec2 Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Thu, 27 Sep 2012 14:43:24 +0200
Subject: [PATCH] Thermal: Fixup to commit 404b134156bd ("Fix synchronization
 issues in thermal_sys.c")


Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
---
 drivers/thermal/thermal_sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index e1179d3..848553d 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -252,7 +252,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
 		}
 
 		tzp = pos->tzp;
-		if (!tzp->tbp)
+		if (!tzp || !tzp->tbp)
 			continue;
 
 		for (i = 0; i < tzp->num_tbps; i++) {
-- 
1.7.9.5


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

* Re: [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c
  2012-09-27 14:05     ` Sedat Dilek
@ 2012-09-27 23:48       ` Hugh Dickins
  2012-09-28  4:57         ` Sedat Dilek
  2012-10-23 10:30         ` Zhang, Rui
  0 siblings, 2 replies; 6+ messages in thread
From: Hugh Dickins @ 2012-09-27 23:48 UTC (permalink / raw)
  To: lenb, rui.zhang
  Cc: Durgadoss R, Sedat Dilek, linux-acpi, dan.carpenter, linux-next

On Thu, 27 Sep 2012, Sedat Dilek wrote:
> >>
> >> The v2 patch does *not* fix the issue here!
> >>
> >> [1] https://patchwork.kernel.org/patch/1511961/
> >>
> >
> > I have re-tested with Linux-Next (next-20120927) plus thermal-next [1]
> > pulled in and see still the same call-trace!

Same here on mmotm, yes.

> >
> > Hugh or Dan can you confirm this works for you or not?
> > Thanks in advance.
> >
> > [1] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=shortlog;h=refs/heads/next
> > [2] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=commitdiff;h=404b134156bd9d9bc506c0974a1254806e13db2c
> >
> 
> With the attached fixup/followup patch, I can boot into my system!
> But, as said yesterday... working within X, Firefox is a pain in the a**.

Indeed, this works for me too, thanks.
Let's get your addition out of the attachment and fold it into a v3.
Mind if we change "synchronization issues" to "oops and unlocking"?


[PATCHv3] Thermal: Fix oops and unlocking in thermal_sys.c

This patch fixes the following mutex and NULL pointer
problems in thermal_sys.c:

 * mutex_unlock fix in update_temperature function
 * mutex_unlock fix in bind_cdev function
 * Correct early return to continue in bind_cdev function
 * NULL check fix in bind_cdev function
 * NULL check fix in bind_tz function

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
---
v3:
 * Sedat restored necessary NULL check in bind_cdev and his signoff.
 * Hugh added two more comments above, his signoff, and Dan's 'Reported-by'.

 drivers/thermal/thermal_sys.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- mmotm/drivers/thermal/thermal_sys.c	2012-09-26 10:15:28.652071362 -0700
+++ linux/drivers/thermal/thermal_sys.c	2012-09-27 16:19:14.427515890 -0700
@@ -252,8 +252,8 @@ static void bind_cdev(struct thermal_coo
 		}
 
 		tzp = pos->tzp;
-		if (!tzp->tbp)
-			return;
+		if (!tzp || !tzp->tbp)
+			continue;
 
 		for (i = 0; i < tzp->num_tbps; i++) {
 			if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
@@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_
 		goto exit;
 	}
 
-	if (!tzp->tbp)
+	if (!tzp || !tzp->tbp)
 		goto exit;
 
 	list_for_each_entry(pos, &thermal_cdev_list, node) {
@@ -387,12 +387,13 @@ static void update_temperature(struct th
 	ret = tz->ops->get_temp(tz, &temp);
 	if (ret) {
 		pr_warn("failed to read out thermal zone %d\n", tz->id);
-		return;
+		goto exit;
 	}
 
 	tz->last_temperature = tz->temperature;
 	tz->temperature = temp;
 
+exit:
 	mutex_unlock(&tz->lock);
 }
 

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

* Re: [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c
  2012-09-27 23:48       ` Hugh Dickins
@ 2012-09-28  4:57         ` Sedat Dilek
  2012-10-23 10:30         ` Zhang, Rui
  1 sibling, 0 replies; 6+ messages in thread
From: Sedat Dilek @ 2012-09-28  4:57 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: lenb, rui.zhang, Durgadoss R, linux-acpi, dan.carpenter, linux-next

On Fri, Sep 28, 2012 at 1:48 AM, Hugh Dickins <hughd@google.com> wrote:
> On Thu, 27 Sep 2012, Sedat Dilek wrote:
>> >>
>> >> The v2 patch does *not* fix the issue here!
>> >>
>> >> [1] https://patchwork.kernel.org/patch/1511961/
>> >>
>> >
>> > I have re-tested with Linux-Next (next-20120927) plus thermal-next [1]
>> > pulled in and see still the same call-trace!
>
> Same here on mmotm, yes.
>
>> >
>> > Hugh or Dan can you confirm this works for you or not?
>> > Thanks in advance.
>> >
>> > [1] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=shortlog;h=refs/heads/next
>> > [2] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=commitdiff;h=404b134156bd9d9bc506c0974a1254806e13db2c
>> >
>>
>> With the attached fixup/followup patch, I can boot into my system!
>> But, as said yesterday... working within X, Firefox is a pain in the a**.
>
> Indeed, this works for me too, thanks.
> Let's get your addition out of the attachment and fold it into a v3.
> Mind if we change "synchronization issues" to "oops and unlocking"?
>
>

Cool, I see this new patch now in [1].
Thanks to all involved people!

- Sedat -

[1] http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=commitdiff;h=6b02e5bd25fea17b3271d275d5700e22d7195a68

> [PATCHv3] Thermal: Fix oops and unlocking in thermal_sys.c
>
> This patch fixes the following mutex and NULL pointer
> problems in thermal_sys.c:
>
>  * mutex_unlock fix in update_temperature function
>  * mutex_unlock fix in bind_cdev function
>  * Correct early return to continue in bind_cdev function
>  * NULL check fix in bind_cdev function
>  * NULL check fix in bind_tz function
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
> Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> v3:
>  * Sedat restored necessary NULL check in bind_cdev and his signoff.
>  * Hugh added two more comments above, his signoff, and Dan's 'Reported-by'.
>
>  drivers/thermal/thermal_sys.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> --- mmotm/drivers/thermal/thermal_sys.c 2012-09-26 10:15:28.652071362 -0700
> +++ linux/drivers/thermal/thermal_sys.c 2012-09-27 16:19:14.427515890 -0700
> @@ -252,8 +252,8 @@ static void bind_cdev(struct thermal_coo
>                 }
>
>                 tzp = pos->tzp;
> -               if (!tzp->tbp)
> -                       return;
> +               if (!tzp || !tzp->tbp)
> +                       continue;
>
>                 for (i = 0; i < tzp->num_tbps; i++) {
>                         if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
> @@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_
>                 goto exit;
>         }
>
> -       if (!tzp->tbp)
> +       if (!tzp || !tzp->tbp)
>                 goto exit;
>
>         list_for_each_entry(pos, &thermal_cdev_list, node) {
> @@ -387,12 +387,13 @@ static void update_temperature(struct th
>         ret = tz->ops->get_temp(tz, &temp);
>         if (ret) {
>                 pr_warn("failed to read out thermal zone %d\n", tz->id);
> -               return;
> +               goto exit;
>         }
>
>         tz->last_temperature = tz->temperature;
>         tz->temperature = temp;
>
> +exit:
>         mutex_unlock(&tz->lock);
>  }
>

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

* RE: [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c
  2012-09-27 23:48       ` Hugh Dickins
  2012-09-28  4:57         ` Sedat Dilek
@ 2012-10-23 10:30         ` Zhang, Rui
  1 sibling, 0 replies; 6+ messages in thread
From: Zhang, Rui @ 2012-10-23 10:30 UTC (permalink / raw)
  To: Hugh Dickins, lenb
  Cc: R, Durgadoss, Sedat Dilek, linux-acpi, dan.carpenter, linux-next



> -----Original Message-----
> From: Hugh Dickins [mailto:hughd@google.com]
> Sent: Friday, September 28, 2012 7:48 AM
> To: lenb@kernel.org; Zhang, Rui
> Cc: R, Durgadoss; Sedat Dilek; linux-acpi@vger.kernel.org;
> dan.carpenter@oracle.com; linux-next@vger.kernel.org
> Subject: Re: [PATCHv2] Thermal: Fix synchronization issues in
> thermal_sys.c
> Importance: High
> 
> On Thu, 27 Sep 2012, Sedat Dilek wrote:
> > >>
> > >> The v2 patch does *not* fix the issue here!
> > >>
> > >> [1] https://patchwork.kernel.org/patch/1511961/
> > >>
> > >
> > > I have re-tested with Linux-Next (next-20120927) plus thermal-next
> > > [1] pulled in and see still the same call-trace!
> 
> Same here on mmotm, yes.
> 
> > >
> > > Hugh or Dan can you confirm this works for you or not?
> > > Thanks in advance.
> > >
> > > [1]
> > >
> http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=shortlo
> > > g;h=refs/heads/next [2]
> > >
> http://git.kernel.org/?p=linux/kernel/git/rzhang/linux.git;a=commitd
> > > iff;h=404b134156bd9d9bc506c0974a1254806e13db2c
> > >
> >
> > With the attached fixup/followup patch, I can boot into my system!
> > But, as said yesterday... working within X, Firefox is a pain in the
> a**.
> 
> Indeed, this works for me too, thanks.
> Let's get your addition out of the attachment and fold it into a v3.
> Mind if we change "synchronization issues" to "oops and unlocking"?
> 
> 
> [PATCHv3] Thermal: Fix oops and unlocking in thermal_sys.c
> 
> This patch fixes the following mutex and NULL pointer problems in
> thermal_sys.c:
> 
>  * mutex_unlock fix in update_temperature function
>  * mutex_unlock fix in bind_cdev function
>  * Correct early return to continue in bind_cdev function
>  * NULL check fix in bind_cdev function
>  * NULL check fix in bind_tz function
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
> Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Hugh Dickins <hughd@google.com>

Applied to thermal -next.

Thanks,
Rui

> ---
> v3:
>  * Sedat restored necessary NULL check in bind_cdev and his signoff.
>  * Hugh added two more comments above, his signoff, and Dan's
> 'Reported-by'.
> 
>  drivers/thermal/thermal_sys.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> --- mmotm/drivers/thermal/thermal_sys.c	2012-09-26 10:15:28.652071362
> -0700
> +++ linux/drivers/thermal/thermal_sys.c	2012-09-27 16:19:14.427515890
> -0700
> @@ -252,8 +252,8 @@ static void bind_cdev(struct thermal_coo
>  		}
> 
>  		tzp = pos->tzp;
> -		if (!tzp->tbp)
> -			return;
> +		if (!tzp || !tzp->tbp)
> +			continue;
> 
>  		for (i = 0; i < tzp->num_tbps; i++) {
>  			if (tzp->tbp[i].cdev || !tzp->tbp[i].match) @@ -289,7
> +289,7 @@ static void bind_tz(struct thermal_zone_
>  		goto exit;
>  	}
> 
> -	if (!tzp->tbp)
> +	if (!tzp || !tzp->tbp)
>  		goto exit;
> 
>  	list_for_each_entry(pos, &thermal_cdev_list, node) { @@ -387,12
> +387,13 @@ static void update_temperature(struct th
>  	ret = tz->ops->get_temp(tz, &temp);
>  	if (ret) {
>  		pr_warn("failed to read out thermal zone %d\n", tz->id);
> -		return;
> +		goto exit;
>  	}
> 
>  	tz->last_temperature = tz->temperature;
>  	tz->temperature = temp;
> 
> +exit:
>  	mutex_unlock(&tz->lock);
>  }
> 

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

end of thread, other threads:[~2012-10-23 10:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-27  6:38 [PATCHv2] Thermal: Fix synchronization issues in thermal_sys.c Durgadoss R
     [not found] ` <CA+icZUXV21BqzAHwPy5gY_VHEws8hXZ8B=vESuPazpmOSQVHvA@mail.gmail.com>
2012-09-27 12:38   ` Sedat Dilek
2012-09-27 14:05     ` Sedat Dilek
2012-09-27 23:48       ` Hugh Dickins
2012-09-28  4:57         ` Sedat Dilek
2012-10-23 10:30         ` Zhang, Rui

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).