diff mbox

[v1,4/4] thermal: mediatek: minor mtk_thermal.c cleanups

Message ID 1501134417-3505-5-git-send-email-louis.yu@mediatek.com (mailing list archive)
State New, archived
Headers show

Commit Message

Louis Yu July 27, 2017, 5:46 a.m. UTC
From: Louis Yu <louis.yu@mediatek.com>

Move thermal module reset in the beginning and revise clock error
handle flow to pair the clock control.

Signed-off-by: Louis Yu <louis.yu@mediatek.com>
---
 drivers/thermal/mtk_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Matthias Brugger July 27, 2017, 3:49 p.m. UTC | #1
On 07/27/2017 07:46 AM, louis.yu@mediatek.com wrote:
> From: Louis Yu <louis.yu@mediatek.com>
> 
> Move thermal module reset in the beginning and revise clock error
> handle flow to pair the clock control.
> 
> Signed-off-by: Louis Yu <louis.yu@mediatek.com>
> ---
>   drivers/thermal/mtk_thermal.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
> index f2a7155..5dffdb4 100644
> --- a/drivers/thermal/mtk_thermal.c
> +++ b/drivers/thermal/mtk_thermal.c
> @@ -712,20 +712,20 @@ static int mtk_thermal_probe(struct platform_device *pdev)
>   		return -EINVAL;
>   	}
>   
> +	ret = device_reset(&pdev->dev);
> +	if (ret)
> +		return ret;
> +
>   	ret = clk_prepare_enable(mt->clk_auxadc);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret);
> -		return ret;
> -	}
> -
> -	ret = device_reset(&pdev->dev);
> -	if (ret)
>   		goto err_disable_clk_auxadc;
> +	}
>   
>   	ret = clk_prepare_enable(mt->clk_peri_therm);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Can't enable peri clk: %d\n", ret);
> -		goto err_disable_clk_auxadc;
> +		goto err_disable_clk_peri_therm;

If you can't enable the clock, there is no use in disable it in the error path.

Regards,
Matthias

>   	}
>   
>   	for (i = 0; i < mt->conf->num_banks; i++)
>
diff mbox

Patch

diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index f2a7155..5dffdb4 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -712,20 +712,20 @@  static int mtk_thermal_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	ret = device_reset(&pdev->dev);
+	if (ret)
+		return ret;
+
 	ret = clk_prepare_enable(mt->clk_auxadc);
 	if (ret) {
 		dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret);
-		return ret;
-	}
-
-	ret = device_reset(&pdev->dev);
-	if (ret)
 		goto err_disable_clk_auxadc;
+	}
 
 	ret = clk_prepare_enable(mt->clk_peri_therm);
 	if (ret) {
 		dev_err(&pdev->dev, "Can't enable peri clk: %d\n", ret);
-		goto err_disable_clk_auxadc;
+		goto err_disable_clk_peri_therm;
 	}
 
 	for (i = 0; i < mt->conf->num_banks; i++)