From: Zhang Rui <rui.zhang@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Eduardo Valentin <edubezval@gmail.com>
Cc: Keerthy <j-keerthy@ti.com>,
linux-pm@vger.kernel.org, linux-omap@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] thermal: ti-soc-thermal: Potential error pointer dereferences
Date: Fri, 11 Aug 2017 02:00:33 +0000 [thread overview]
Message-ID: <1502416833.2598.3.camel@intel.com> (raw)
In-Reply-To: <20170710072422.rs25i5oawmiaofrp@mwanda>
On Mon, 2017-07-10 at 10:24 +0300, Dan Carpenter wrote:
> ti_bandgap_get_sensor_data() can return error pointers so we should
> check for that. There is no need to check "data->ti_thermal" for
> NULL
> and we removed that from the other cleanup function so we may as well
> from it in ti_thermal_remove_sensor() to be consistent.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> index c211a8e4a210..9fea354ca90c 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> @@ -210,7 +210,7 @@ int ti_thermal_remove_sensor(struct ti_bandgap
> *bgp, int id)
>
> data = ti_bandgap_get_sensor_data(bgp, id);
>
> - if (data && data->ti_thermal) {
> + if (data && !IS_ERR(data)) {
what about
if (!IS_ERR_OR_NULL(data))
thanks,
rui
> if (data->our_zone)
> thermal_zone_device_unregister(data-
> >ti_thermal);
> }
> @@ -276,7 +276,7 @@ int ti_thermal_unregister_cpu_cooling(struct
> ti_bandgap *bgp, int id)
>
> data = ti_bandgap_get_sensor_data(bgp, id);
>
> - if (data) {
> + if (data && !IS_ERR(data)) {
> cpufreq_cooling_unregister(data->cool_dev);
> cpufreq_cpu_put(data->policy);
> }
WARNING: multiple messages have this Message-ID (diff)
From: Zhang Rui <rui.zhang@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Eduardo Valentin <edubezval@gmail.com>
Cc: Keerthy <j-keerthy@ti.com>,
linux-pm@vger.kernel.org, linux-omap@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] thermal: ti-soc-thermal: Potential error pointer dereferences
Date: Fri, 11 Aug 2017 10:00:33 +0800 [thread overview]
Message-ID: <1502416833.2598.3.camel@intel.com> (raw)
In-Reply-To: <20170710072422.rs25i5oawmiaofrp@mwanda>
On Mon, 2017-07-10 at 10:24 +0300, Dan Carpenter wrote:
> ti_bandgap_get_sensor_data() can return error pointers so we should
> check for that. There is no need to check "data->ti_thermal" for
> NULL
> and we removed that from the other cleanup function so we may as well
> from it in ti_thermal_remove_sensor() to be consistent.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> index c211a8e4a210..9fea354ca90c 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> @@ -210,7 +210,7 @@ int ti_thermal_remove_sensor(struct ti_bandgap
> *bgp, int id)
>
> data = ti_bandgap_get_sensor_data(bgp, id);
>
> - if (data && data->ti_thermal) {
> + if (data && !IS_ERR(data)) {
what about
if (!IS_ERR_OR_NULL(data))
thanks,
rui
> if (data->our_zone)
> thermal_zone_device_unregister(data-
> >ti_thermal);
> }
> @@ -276,7 +276,7 @@ int ti_thermal_unregister_cpu_cooling(struct
> ti_bandgap *bgp, int id)
>
> data = ti_bandgap_get_sensor_data(bgp, id);
>
> - if (data) {
> + if (data && !IS_ERR(data)) {
> cpufreq_cooling_unregister(data->cool_dev);
> cpufreq_cpu_put(data->policy);
> }
next prev parent reply other threads:[~2017-08-11 2:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 7:24 [PATCH] thermal: ti-soc-thermal: Potential error pointer dereferences Dan Carpenter
2017-07-10 7:24 ` Dan Carpenter
2017-08-11 2:00 ` Zhang Rui [this message]
2017-08-11 2:00 ` Zhang Rui
2017-08-11 7:55 ` Dan Carpenter
2017-08-11 7:55 ` Dan Carpenter
2017-08-15 6:26 ` Zhang Rui
2017-08-15 6:26 ` Zhang Rui
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=1502416833.2598.3.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=edubezval@gmail.com \
--cc=j-keerthy@ti.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.