linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register
@ 2013-03-12 15:42 Axel Lin
  2013-03-12 15:43 ` [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths Axel Lin
  2013-03-25  8:09 ` [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register Zhang Rui
  0 siblings, 2 replies; 6+ messages in thread
From: Axel Lin @ 2013-03-12 15:42 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Hongbo Zhang, Viresh Kumar, Francesco Lavra, linux-pm

thermal_zone_device_register() returns ERR_PTR on error, thus use
IS_ERR rather than IS_ERR_OR_NULL to check return value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/thermal/db8500_thermal.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
index 61ce60a..6bdcec4 100644
--- a/drivers/thermal/db8500_thermal.c
+++ b/drivers/thermal/db8500_thermal.c
@@ -447,7 +447,7 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 	pzone->therm_dev = thermal_zone_device_register("db8500_thermal_zone",
 		ptrips->num_trips, 0, pzone, &thdev_ops, NULL, 0, 0);
 
-	if (IS_ERR_OR_NULL(pzone->therm_dev)) {
+	if (IS_ERR(pzone->therm_dev)) {
 		dev_err(&pdev->dev, "Register thermal zone device failed.\n");
 		return PTR_ERR(pzone->therm_dev);
 	}
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths
  2013-03-12 15:42 [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register Axel Lin
@ 2013-03-12 15:43 ` Axel Lin
  2013-03-13  8:13   ` Hongbo Zhang
  2013-03-25  8:09   ` Zhang Rui
  2013-03-25  8:09 ` [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register Zhang Rui
  1 sibling, 2 replies; 6+ messages in thread
From: Axel Lin @ 2013-03-12 15:43 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Hongbo Zhang, Viresh Kumar, Francesco Lavra, linux-pm

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/thermal/db8500_thermal.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
index 6bdcec4..1e3b3bf 100644
--- a/drivers/thermal/db8500_thermal.c
+++ b/drivers/thermal/db8500_thermal.c
@@ -419,7 +419,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 	low_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_LOW");
 	if (low_irq < 0) {
 		dev_err(&pdev->dev, "Get IRQ_HOTMON_LOW failed.\n");
-		return low_irq;
+		ret = low_irq;
+		goto out_unlock;
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, low_irq, NULL,
@@ -427,13 +428,14 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 		"dbx500_temp_low", pzone);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to allocate temp low irq.\n");
-		return ret;
+		goto out_unlock;
 	}
 
 	high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH");
 	if (high_irq < 0) {
 		dev_err(&pdev->dev, "Get IRQ_HOTMON_HIGH failed.\n");
-		return high_irq;
+		ret = high_irq;
+		goto out_unlock;
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, high_irq, NULL,
@@ -441,7 +443,7 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 		"dbx500_temp_high", pzone);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to allocate temp high irq.\n");
-		return ret;
+		goto out_unlock;
 	}
 
 	pzone->therm_dev = thermal_zone_device_register("db8500_thermal_zone",
@@ -449,7 +451,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 
 	if (IS_ERR(pzone->therm_dev)) {
 		dev_err(&pdev->dev, "Register thermal zone device failed.\n");
-		return PTR_ERR(pzone->therm_dev);
+		ret = PTR_ERR(pzone->therm_dev);
+		goto out_unlock;
 	}
 	dev_info(&pdev->dev, "Thermal zone device registered.\n");
 
@@ -461,9 +464,11 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pzone);
 	pzone->mode = THERMAL_DEVICE_ENABLED;
+
+out_unlock:
 	mutex_unlock(&pzone->th_lock);
 
-	return 0;
+	return ret;
 }
 
 static int db8500_thermal_remove(struct platform_device *pdev)
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths
  2013-03-12 15:43 ` [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths Axel Lin
@ 2013-03-13  8:13   ` Hongbo Zhang
  2013-03-13  8:17     ` Axel Lin
  2013-03-25  8:09   ` Zhang Rui
  1 sibling, 1 reply; 6+ messages in thread
From: Hongbo Zhang @ 2013-03-13  8:13 UTC (permalink / raw)
  To: Axel Lin; +Cc: Zhang Rui, Hongbo Zhang, Viresh Kumar, Francesco Lavra, linux-pm

On 12 March 2013 23:43, Axel Lin <axel.lin@ingics.com> wrote:

It is better to say some commit message here I think.

> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/thermal/db8500_thermal.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
> index 6bdcec4..1e3b3bf 100644
> --- a/drivers/thermal/db8500_thermal.c
> +++ b/drivers/thermal/db8500_thermal.c
> @@ -419,7 +419,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>         low_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_LOW");
>         if (low_irq < 0) {
>                 dev_err(&pdev->dev, "Get IRQ_HOTMON_LOW failed.\n");
> -               return low_irq;
> +               ret = low_irq;
> +               goto out_unlock;
>         }
>
>         ret = devm_request_threaded_irq(&pdev->dev, low_irq, NULL,
> @@ -427,13 +428,14 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>                 "dbx500_temp_low", pzone);
>         if (ret < 0) {
>                 dev_err(&pdev->dev, "Failed to allocate temp low irq.\n");
> -               return ret;
> +               goto out_unlock;
>         }
>
>         high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH");
>         if (high_irq < 0) {
>                 dev_err(&pdev->dev, "Get IRQ_HOTMON_HIGH failed.\n");
> -               return high_irq;
> +               ret = high_irq;
> +               goto out_unlock;
>         }
>
>         ret = devm_request_threaded_irq(&pdev->dev, high_irq, NULL,
> @@ -441,7 +443,7 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>                 "dbx500_temp_high", pzone);
>         if (ret < 0) {
>                 dev_err(&pdev->dev, "Failed to allocate temp high irq.\n");
> -               return ret;
> +               goto out_unlock;
>         }
>
>         pzone->therm_dev = thermal_zone_device_register("db8500_thermal_zone",
> @@ -449,7 +451,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>
>         if (IS_ERR(pzone->therm_dev)) {
>                 dev_err(&pdev->dev, "Register thermal zone device failed.\n");
> -               return PTR_ERR(pzone->therm_dev);
> +               ret = PTR_ERR(pzone->therm_dev);
> +               goto out_unlock;
>         }
>         dev_info(&pdev->dev, "Thermal zone device registered.\n");
>
> @@ -461,9 +464,11 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>
>         platform_set_drvdata(pdev, pzone);
>         pzone->mode = THERMAL_DEVICE_ENABLED;
> +
> +out_unlock:

This was my carelessness really, thanks.

>         mutex_unlock(&pzone->th_lock);
>
> -       return 0;
> +       return ret;
>  }
>
>  static int db8500_thermal_remove(struct platform_device *pdev)
> --
> 1.7.9.5
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths
  2013-03-13  8:13   ` Hongbo Zhang
@ 2013-03-13  8:17     ` Axel Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Axel Lin @ 2013-03-13  8:17 UTC (permalink / raw)
  To: Hongbo Zhang
  Cc: Zhang Rui, Hongbo Zhang, Viresh Kumar, Francesco Lavra, linux-pm

2013/3/13 Hongbo Zhang <hongbo.zhang@linaro.org>:
> On 12 March 2013 23:43, Axel Lin <axel.lin@ingics.com> wrote:
>
> It is better to say some commit message here I think.

In this case, the subject line is *very clear* about the change.
I think it is ok to avoid duplicate the same commit message.

Regards,
Axel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register
  2013-03-12 15:42 [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register Axel Lin
  2013-03-12 15:43 ` [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths Axel Lin
@ 2013-03-25  8:09 ` Zhang Rui
  1 sibling, 0 replies; 6+ messages in thread
From: Zhang Rui @ 2013-03-25  8:09 UTC (permalink / raw)
  To: Axel Lin; +Cc: Hongbo Zhang, Viresh Kumar, Francesco Lavra, linux-pm

On Tue, 2013-03-12 at 23:42 +0800, Axel Lin wrote:
> thermal_zone_device_register() returns ERR_PTR on error, thus use
> IS_ERR rather than IS_ERR_OR_NULL to check return value.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

applied to thermal -next.

thanks,
rui
> ---
>  drivers/thermal/db8500_thermal.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
> index 61ce60a..6bdcec4 100644
> --- a/drivers/thermal/db8500_thermal.c
> +++ b/drivers/thermal/db8500_thermal.c
> @@ -447,7 +447,7 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>  	pzone->therm_dev = thermal_zone_device_register("db8500_thermal_zone",
>  		ptrips->num_trips, 0, pzone, &thdev_ops, NULL, 0, 0);
>  
> -	if (IS_ERR_OR_NULL(pzone->therm_dev)) {
> +	if (IS_ERR(pzone->therm_dev)) {
>  		dev_err(&pdev->dev, "Register thermal zone device failed.\n");
>  		return PTR_ERR(pzone->therm_dev);
>  	}



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths
  2013-03-12 15:43 ` [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths Axel Lin
  2013-03-13  8:13   ` Hongbo Zhang
@ 2013-03-25  8:09   ` Zhang Rui
  1 sibling, 0 replies; 6+ messages in thread
From: Zhang Rui @ 2013-03-25  8:09 UTC (permalink / raw)
  To: Axel Lin; +Cc: Hongbo Zhang, Viresh Kumar, Francesco Lavra, linux-pm

On Tue, 2013-03-12 at 23:43 +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

applied to thermal -next.

thanks,
rui

> ---
>  drivers/thermal/db8500_thermal.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
> index 6bdcec4..1e3b3bf 100644
> --- a/drivers/thermal/db8500_thermal.c
> +++ b/drivers/thermal/db8500_thermal.c
> @@ -419,7 +419,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>  	low_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_LOW");
>  	if (low_irq < 0) {
>  		dev_err(&pdev->dev, "Get IRQ_HOTMON_LOW failed.\n");
> -		return low_irq;
> +		ret = low_irq;
> +		goto out_unlock;
>  	}
>  
>  	ret = devm_request_threaded_irq(&pdev->dev, low_irq, NULL,
> @@ -427,13 +428,14 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>  		"dbx500_temp_low", pzone);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "Failed to allocate temp low irq.\n");
> -		return ret;
> +		goto out_unlock;
>  	}
>  
>  	high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH");
>  	if (high_irq < 0) {
>  		dev_err(&pdev->dev, "Get IRQ_HOTMON_HIGH failed.\n");
> -		return high_irq;
> +		ret = high_irq;
> +		goto out_unlock;
>  	}
>  
>  	ret = devm_request_threaded_irq(&pdev->dev, high_irq, NULL,
> @@ -441,7 +443,7 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>  		"dbx500_temp_high", pzone);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "Failed to allocate temp high irq.\n");
> -		return ret;
> +		goto out_unlock;
>  	}
>  
>  	pzone->therm_dev = thermal_zone_device_register("db8500_thermal_zone",
> @@ -449,7 +451,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>  
>  	if (IS_ERR(pzone->therm_dev)) {
>  		dev_err(&pdev->dev, "Register thermal zone device failed.\n");
> -		return PTR_ERR(pzone->therm_dev);
> +		ret = PTR_ERR(pzone->therm_dev);
> +		goto out_unlock;
>  	}
>  	dev_info(&pdev->dev, "Thermal zone device registered.\n");
>  
> @@ -461,9 +464,11 @@ static int db8500_thermal_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pzone);
>  	pzone->mode = THERMAL_DEVICE_ENABLED;
> +
> +out_unlock:
>  	mutex_unlock(&pzone->th_lock);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static int db8500_thermal_remove(struct platform_device *pdev)



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-25  8:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12 15:42 [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register Axel Lin
2013-03-12 15:43 ` [PATCH 2/2] thermal: db8500: Fix missing mutex_unlock() in probe error paths Axel Lin
2013-03-13  8:13   ` Hongbo Zhang
2013-03-13  8:17     ` Axel Lin
2013-03-25  8:09   ` Zhang Rui
2013-03-25  8:09 ` [PATCH 1/2] thermal: db8500: Fix checking return value of thermal_zone_device_register 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).