]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
thermal: check tz device is registered
authorJinyoung Park <jinyoungp@nvidia.com>
Tue, 17 Jun 2014 08:03:51 +0000 (17:03 +0900)
committerDhiren Parmar <dparmar@nvidia.com>
Fri, 11 Jul 2014 09:38:54 +0000 (02:38 -0700)
Checking thermal zone device whether it is registered or not.

Bug 200011588

Change-Id: I377583f887d3dbe8258daa46d777daa6337b192f
Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/424088
(cherry picked from commit 397ce28d1841853103bc028080dfb00656211b9e)
Reviewed-on: http://git-master/r/427501
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
drivers/thermal/thermal_core.c

index 72ac8a7770f6d7675f62ff3710138d2009031bcc..9fad88c635bea08b9ee53b1d1aea47abc9d45acf 100644 (file)
@@ -418,7 +418,8 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
        enum thermal_trip_type type;
 #endif
 
-       if (!tz || IS_ERR(tz) || !tz->ops->get_temp)
+       if (!tz || IS_ERR(tz) || !tz->ops->get_temp ||
+                       !device_is_registered(&tz->device))
                goto exit;
 
        mutex_lock(&tz->lock);
@@ -471,7 +472,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
 {
        int count;
 
-       if (!tz->ops->get_temp)
+       if (!tz || !tz->ops->get_temp || !device_is_registered(&tz->device))
                return;
 
        update_temperature(tz);