From: Zhang Rui <rui.zhang@intel.com>
To: Durgadoss R <durgadoss.r@intel.com>
Cc: lenb@kernel.org, linux-acpi@vger.kernel.org,
dan.carpenter@oracle.com, hughd@google.com,
linux-next@vger.kernel.org
Subject: Re: [PATCH] Thermal: Fix synchronization issues in thermal_sys.c
Date: Thu, 27 Sep 2012 14:14:44 +0800 [thread overview]
Message-ID: <1348726484.10877.278.camel@rui.sh.intel.com> (raw)
In-Reply-To: <1348726083-8540-1-git-send-email-durgadoss.r@intel.com>
On 四, 2012-09-27 at 11:38 +0530, Durgadoss R wrote:
> This patch fixes the following mutex and NULL pointer
> problems in thermal_sys.c:
> * mutex_unlock fix in update_temperature function
> * mutex_unlock/NULL check fix in bind_cdev function
> * NULL check fix in bind_tz function
>
> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
> ---
> drivers/thermal/thermal_sys.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
> index 4f77d89..848553d 100644
> --- a/drivers/thermal/thermal_sys.c
> +++ b/drivers/thermal/thermal_sys.c
> @@ -252,8 +252,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
> }
>
> 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_device *tz)
> goto exit;
> }
>
> - if (!tzp->tbp)
> + if (!tzp || !tzp->tbp)
> goto exit;
>
actually, this is not a problem.
I checked the code just now, tzp can not be NULL if the code runs here.
> 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);
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-09-27 6:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 6:08 [PATCH] Thermal: Fix synchronization issues in thermal_sys.c Durgadoss R
2012-09-27 6:14 ` Zhang Rui [this message]
2012-09-27 6:21 ` R, Durgadoss
2012-09-27 6:25 ` Sedat Dilek
2012-09-27 8:07 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348726484.10877.278.camel@rui.sh.intel.com \
--to=rui.zhang@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=durgadoss.r@intel.com \
--cc=hughd@google.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).