linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal: imx: improve error message
@ 2018-09-13  9:13 Anson Huang
  2018-09-13  9:13 ` [PATCH 2/2] thermal: imx: handle error path in one place to save duplicated code Anson Huang
  2018-09-13 13:43 ` [PATCH 1/2] thermal: imx: improve error message Daniel Lezcano
  0 siblings, 2 replies; 6+ messages in thread
From: Anson Huang @ 2018-09-13  9:13 UTC (permalink / raw)
  To: rui.zhang, edubezval, daniel.lezcano, linux-pm, linux-kernel

Remove the duplicated "from" to improve the error message.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/thermal/imx_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index aa452ac..6cfa2a8 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -725,7 +725,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
 	} else {
 		ret = imx_init_from_tempmon_data(pdev);
 		if (ret) {
-			dev_err(&pdev->dev, "failed to init from from fsl,tempmon-data\n");
+			dev_err(&pdev->dev, "failed to init from fsl,tempmon-data\n");
 			return ret;
 		}
 	}
-- 
2.7.4


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

* [PATCH 2/2] thermal: imx: handle error path in one place to save duplicated code
  2018-09-13  9:13 [PATCH 1/2] thermal: imx: improve error message Anson Huang
@ 2018-09-13  9:13 ` Anson Huang
  2018-09-13 13:43   ` Daniel Lezcano
  2018-09-13 13:43 ` [PATCH 1/2] thermal: imx: improve error message Daniel Lezcano
  1 sibling, 1 reply; 6+ messages in thread
From: Anson Huang @ 2018-09-13  9:13 UTC (permalink / raw)
  To: rui.zhang, edubezval, daniel.lezcano, linux-pm, linux-kernel

During probe phase, the error path can be handled in one place and
use goto method to save many duplicated code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/thermal/imx_thermal.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 6cfa2a8..1566154 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -762,9 +762,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
 		if (ret != -EPROBE_DEFER)
 			dev_err(&pdev->dev,
 				"failed to get thermal clk: %d\n", ret);
-		cpufreq_cooling_unregister(data->cdev);
-		cpufreq_cpu_put(data->policy);
-		return ret;
+		goto cpufreq_put;
 	}
 
 	/*
@@ -777,9 +775,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
 	ret = clk_prepare_enable(data->thermal_clk);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
-		cpufreq_cooling_unregister(data->cdev);
-		cpufreq_cpu_put(data->policy);
-		return ret;
+		goto cpufreq_put;
 	}
 
 	data->tz = thermal_zone_device_register("imx_thermal_zone",
@@ -792,10 +788,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
 		ret = PTR_ERR(data->tz);
 		dev_err(&pdev->dev,
 			"failed to register thermal zone device %d\n", ret);
-		clk_disable_unprepare(data->thermal_clk);
-		cpufreq_cooling_unregister(data->cdev);
-		cpufreq_cpu_put(data->policy);
-		return ret;
+		goto clk_disable;
 	}
 
 	dev_info(&pdev->dev, "%s CPU temperature grade - max:%dC"
@@ -827,14 +820,20 @@ static int imx_thermal_probe(struct platform_device *pdev)
 			0, "imx_thermal", data);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret);
-		clk_disable_unprepare(data->thermal_clk);
-		thermal_zone_device_unregister(data->tz);
-		cpufreq_cooling_unregister(data->cdev);
-		cpufreq_cpu_put(data->policy);
-		return ret;
+		goto thermal_zone_unregister;
 	}
 
 	return 0;
+
+thermal_zone_unregister:
+	thermal_zone_device_unregister(data->tz);
+clk_disable:
+	clk_disable_unprepare(data->thermal_clk);
+cpufreq_put:
+	cpufreq_cooling_unregister(data->cdev);
+	cpufreq_cpu_put(data->policy);
+
+	return ret;
 }
 
 static int imx_thermal_remove(struct platform_device *pdev)
-- 
2.7.4


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

* Re: [PATCH 2/2] thermal: imx: handle error path in one place to save duplicated code
  2018-09-13  9:13 ` [PATCH 2/2] thermal: imx: handle error path in one place to save duplicated code Anson Huang
@ 2018-09-13 13:43   ` Daniel Lezcano
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2018-09-13 13:43 UTC (permalink / raw)
  To: Anson Huang, rui.zhang, edubezval, linux-pm, linux-kernel

On 13/09/2018 11:13, Anson Huang wrote:
> During probe phase, the error path can be handled in one place and
> use goto method to save many duplicated code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---

Thanks for this cleanup.

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH 1/2] thermal: imx: improve error message
  2018-09-13  9:13 [PATCH 1/2] thermal: imx: improve error message Anson Huang
  2018-09-13  9:13 ` [PATCH 2/2] thermal: imx: handle error path in one place to save duplicated code Anson Huang
@ 2018-09-13 13:43 ` Daniel Lezcano
  2018-10-12  6:42   ` Anson Huang
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2018-09-13 13:43 UTC (permalink / raw)
  To: Anson Huang, rui.zhang, edubezval, linux-pm, linux-kernel

On 13/09/2018 11:13, Anson Huang wrote:
> Remove the duplicated "from" to improve the error message.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* RE: [PATCH 1/2] thermal: imx: improve error message
  2018-09-13 13:43 ` [PATCH 1/2] thermal: imx: improve error message Daniel Lezcano
@ 2018-10-12  6:42   ` Anson Huang
  2018-10-22  1:43     ` Anson Huang
  0 siblings, 1 reply; 6+ messages in thread
From: Anson Huang @ 2018-10-12  6:42 UTC (permalink / raw)
  To: Daniel Lezcano, rui.zhang, edubezval, linux-pm, linux-kernel

Gentle ping this patch set....

Anson Huang
Best Regards!


> -----Original Message-----
> From: Daniel Lezcano <daniel.lezcano@linaro.org>
> Sent: Thursday, September 13, 2018 9:43 PM
> To: Anson Huang <anson.huang@nxp.com>; rui.zhang@intel.com;
> edubezval@gmail.com; linux-pm@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/2] thermal: imx: improve error message
> 
> On 13/09/2018 11:13, Anson Huang wrote:
> > Remove the duplicated "from" to improve the error message.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> 
> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> --
> 
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2F&amp;data=02%7C01%7CAnson.Huang%40nxp.com%7C74b0e3
> 69dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> 0%7C0%7C636724430129789013&amp;sdata=C9l8QFt58YJVo5prvwHNqSiOP5
> 4opUMPGOfzyV4PZFA%3D&amp;reserved=0> Linaro.org │ Open source
> software for ARM SoCs
> 
> Follow Linaro:
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .facebook.com%2Fpages%2FLinaro&amp;data=02%7C01%7CAnson.Huang%40
> nxp.com%7C74b0e369dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92
> cd99c5c301635%7C0%7C0%7C636724430129789013&amp;sdata=SqfGf6a4n
> MQvO5dvAjhXPkxJRKxZm9%2FO37LLx8nBmJ4%3D&amp;reserved=0>
> Facebook |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitt
> er.com%2F%23!%2Flinaroorg&amp;data=02%7C01%7CAnson.Huang%40nxp.c
> om%7C74b0e369dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92cd99
> c5c301635%7C0%7C0%7C636724430129789013&amp;sdata=eOf2nvCdJErmV
> ra12uxlZ42LFjjryHA3u4BqmEFhApE%3D&amp;reserved=0> Twitter |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Flinaro-blog%2F&amp;data=02%7C01%7CAnson.Huang%40nxp.c
> om%7C74b0e369dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92cd99
> c5c301635%7C0%7C0%7C636724430129789013&amp;sdata=Vcq2CZ3Wutz6Z
> xQ77tpow30X2w%2FVsmj43yl1M53GcWU%3D&amp;reserved=0> Blog


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

* RE: [PATCH 1/2] thermal: imx: improve error message
  2018-10-12  6:42   ` Anson Huang
@ 2018-10-22  1:43     ` Anson Huang
  0 siblings, 0 replies; 6+ messages in thread
From: Anson Huang @ 2018-10-22  1:43 UTC (permalink / raw)
  To: Daniel Lezcano, rui.zhang, edubezval, linux-pm, linux-kernel

Ping...

Anson Huang
Best Regards!


> -----Original Message-----
> From: Anson Huang
> Sent: Friday, October 12, 2018 2:42 PM
> To: 'Daniel Lezcano' <daniel.lezcano@linaro.org>; rui.zhang@intel.com;
> edubezval@gmail.com; linux-pm@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: RE: [PATCH 1/2] thermal: imx: improve error message
> 
> Gentle ping this patch set....
> 
> Anson Huang
> Best Regards!
> 
> 
> > -----Original Message-----
> > From: Daniel Lezcano <daniel.lezcano@linaro.org>
> > Sent: Thursday, September 13, 2018 9:43 PM
> > To: Anson Huang <anson.huang@nxp.com>; rui.zhang@intel.com;
> > edubezval@gmail.com; linux-pm@vger.kernel.org;
> > linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH 1/2] thermal: imx: improve error message
> >
> > On 13/09/2018 11:13, Anson Huang wrote:
> > > Remove the duplicated "from" to improve the error message.
> > >
> > > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > > ---
> >
> > Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> >
> > --
> >
> >
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> > .linaro.org%2F&amp;data=02%7C01%7CAnson.Huang%40nxp.com%7C74b0
> e3
> >
> 69dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> >
> 0%7C0%7C636724430129789013&amp;sdata=C9l8QFt58YJVo5prvwHNqSiOP5
> > 4opUMPGOfzyV4PZFA%3D&amp;reserved=0> Linaro.org │ Open source
> software
> > for ARM SoCs
> >
> > Follow Linaro:
> >
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> > .facebook.com%2Fpages%2FLinaro&amp;data=02%7C01%7CAnson.Huang%
> 40
> >
> nxp.com%7C74b0e369dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92
> > cd99c5c301635%7C0%7C0%7C636724430129789013&amp;sdata=SqfGf6a4n
> > MQvO5dvAjhXPkxJRKxZm9%2FO37LLx8nBmJ4%3D&amp;reserved=0>
> > Facebook |
> > <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwi
> > tt
> er.com%2F%23!%2Flinaroorg&amp;data=02%7C01%7CAnson.Huang%40nxp.c
> >
> om%7C74b0e369dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92cd99
> >
> c5c301635%7C0%7C0%7C636724430129789013&amp;sdata=eOf2nvCdJErmV
> > ra12uxlZ42LFjjryHA3u4BqmEFhApE%3D&amp;reserved=0> Twitter |
> >
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> > .linaro.org%2Flinaro-blog%2F&amp;data=02%7C01%7CAnson.Huang%40nxp.
> c
> >
> om%7C74b0e369dea442cd23ca08d6197ee518%7C686ea1d3bc2b4c6fa92cd99
> >
> c5c301635%7C0%7C0%7C636724430129789013&amp;sdata=Vcq2CZ3Wutz6Z
> > xQ77tpow30X2w%2FVsmj43yl1M53GcWU%3D&amp;reserved=0> Blog


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

end of thread, other threads:[~2018-10-22  1:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13  9:13 [PATCH 1/2] thermal: imx: improve error message Anson Huang
2018-09-13  9:13 ` [PATCH 2/2] thermal: imx: handle error path in one place to save duplicated code Anson Huang
2018-09-13 13:43   ` Daniel Lezcano
2018-09-13 13:43 ` [PATCH 1/2] thermal: imx: improve error message Daniel Lezcano
2018-10-12  6:42   ` Anson Huang
2018-10-22  1:43     ` Anson Huang

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).