* [PATCH] thermal: fair_share: check for a valid thermal zone device
@ 2013-03-30 10:04 Devendra Naga
2013-04-01 1:05 ` Zhang Rui
0 siblings, 1 reply; 2+ messages in thread
From: Devendra Naga @ 2013-03-30 10:04 UTC (permalink / raw)
To: Zhang Rui, linux-pm; +Cc: Devendra Naga
to be on safe side check for a valid thermal zone device and fail if there
is no thermal zone device.
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
drivers/thermal/fair_share.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c
index 792479f..4cd1d47 100644
--- a/drivers/thermal/fair_share.c
+++ b/drivers/thermal/fair_share.c
@@ -85,7 +85,7 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
int i;
int cur_trip_level = get_trip_level(tz);
- if (!tz->tzp || !tz->tzp->tbp)
+ if (!tz || !tz->tzp || !tz->tzp->tbp)
return -EINVAL;
tzp = tz->tzp;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] thermal: fair_share: check for a valid thermal zone device
2013-03-30 10:04 [PATCH] thermal: fair_share: check for a valid thermal zone device Devendra Naga
@ 2013-04-01 1:05 ` Zhang Rui
0 siblings, 0 replies; 2+ messages in thread
From: Zhang Rui @ 2013-04-01 1:05 UTC (permalink / raw)
To: Devendra Naga; +Cc: linux-pm
On Sat, 2013-03-30 at 15:34 +0530, Devendra Naga wrote:
> to be on safe side check for a valid thermal zone device and fail if there
> is no thermal zone device.
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
> ---
> drivers/thermal/fair_share.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c
> index 792479f..4cd1d47 100644
> --- a/drivers/thermal/fair_share.c
> +++ b/drivers/thermal/fair_share.c
> @@ -85,7 +85,7 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
> int i;
> int cur_trip_level = get_trip_level(tz);
>
> - if (!tz->tzp || !tz->tzp->tbp)
> + if (!tz || !tz->tzp || !tz->tzp->tbp)
> return -EINVAL;
when tz equals NULL, it suggests a really serious problem, and IMO, a
NULL pointer dereference or Panic in this case is more meaningful.
thanks,
rui
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-01 1:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-30 10:04 [PATCH] thermal: fair_share: check for a valid thermal zone device Devendra Naga
2013-04-01 1:05 ` 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).