[2/3] thermal: exynos: Fix potential NULL pointer dereference

Message ID 1376893723-22138-2-git-send-email-sachin.kamat@linaro.org
State Accepted
Commit 91ff81cf48f0c8f9cd608acbd83f0e98a228807b
Headers show

Commit Message

Sachin Kamat Aug. 19, 2013, 6:28 a.m.
NULL pointer was being dereferenced in its own error message.
Changed it to the correct device pointer.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/thermal/samsung/exynos_thermal_common.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Eduardo Valentin Aug. 29, 2013, 12:17 p.m. | #1
On 19-08-2013 02:28, Sachin Kamat wrote:
> NULL pointer was being dereferenced in its own error message.
> Changed it to the correct device pointer.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>


Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>

> ---
>  drivers/thermal/samsung/exynos_thermal_common.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
> index 4d8e444..f10a6ad 100644
> --- a/drivers/thermal/samsung/exynos_thermal_common.c
> +++ b/drivers/thermal/samsung/exynos_thermal_common.c
> @@ -53,7 +53,7 @@ static int exynos_set_mode(struct thermal_zone_device *thermal,
>  {
>  	struct exynos_thermal_zone *th_zone = thermal->devdata;
>  	if (!th_zone) {
> -		dev_err(th_zone->sensor_conf->dev,
> +		dev_err(&thermal->device,
>  			"thermal zone not registered\n");
>  		return 0;
>  	}
> @@ -231,7 +231,7 @@ static int exynos_get_temp(struct thermal_zone_device *thermal,
>  	void *data;
>  
>  	if (!th_zone->sensor_conf) {
> -		dev_err(th_zone->sensor_conf->dev,
> +		dev_err(&thermal->device,
>  			"Temperature sensor not initialised\n");
>  		return -EINVAL;
>  	}
> @@ -251,7 +251,7 @@ static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
>  	struct exynos_thermal_zone *th_zone = thermal->devdata;
>  
>  	if (!th_zone->sensor_conf) {
> -		dev_err(th_zone->sensor_conf->dev,
> +		dev_err(&thermal->device,
>  			"Temperature sensor not initialised\n");
>  		return -EINVAL;
>  	}
>

Patch

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
index 4d8e444..f10a6ad 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -53,7 +53,7 @@  static int exynos_set_mode(struct thermal_zone_device *thermal,
 {
 	struct exynos_thermal_zone *th_zone = thermal->devdata;
 	if (!th_zone) {
-		dev_err(th_zone->sensor_conf->dev,
+		dev_err(&thermal->device,
 			"thermal zone not registered\n");
 		return 0;
 	}
@@ -231,7 +231,7 @@  static int exynos_get_temp(struct thermal_zone_device *thermal,
 	void *data;
 
 	if (!th_zone->sensor_conf) {
-		dev_err(th_zone->sensor_conf->dev,
+		dev_err(&thermal->device,
 			"Temperature sensor not initialised\n");
 		return -EINVAL;
 	}
@@ -251,7 +251,7 @@  static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
 	struct exynos_thermal_zone *th_zone = thermal->devdata;
 
 	if (!th_zone->sensor_conf) {
-		dev_err(th_zone->sensor_conf->dev,
+		dev_err(&thermal->device,
 			"Temperature sensor not initialised\n");
 		return -EINVAL;
 	}