Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Louis Yu <louis.yu@mediatek.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	dawei.chien@mediatek.com, fan.chen@mediatek.com,
	eddie.huang@mediatek.com, linux-pm@vger.kernel.org,
	linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com
Subject: Re: [PATCH v1 4/4] thermal: mediatek: minor mtk_thermal.c cleanups
Date: Mon, 31 Jul 2017 15:23:31 +0800	[thread overview]
Message-ID: <1501485811.9219.34.camel@mtksdaap41> (raw)
In-Reply-To: <c8585136-d7a8-3a47-1af2-512c6485eca0@gmail.com>

Hi Matthias,

On Thu, 2017-07-27 at 17:49 +0200, Matthias Brugger wrote:
> 
> 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
> 

Thanks for your reminder.This is no use to disable it in the error path.
I would update this in next version as follows.

diff --git a/drivers/thermal/mtk_thermal.c
b/drivers/thermal/mtk_thermal.c
index 5dffdb4..3df0de3 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -719,13 +719,13 @@ static int mtk_thermal_probe(struct
platform_device *pdev)
 	ret = clk_prepare_enable(mt->clk_auxadc);
 	if (ret) {
 		dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret);
-		goto err_disable_clk_auxadc;
+		return ret;
 	}
 
 	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_peri_therm;
+		goto err_disable_clk_auxadc;
 	}
 
 	for (i = 0; i < mt->conf->num_banks; i++)


Regards
Louis

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

      reply	other threads:[~2017-07-31  7:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27  5:46 [PATCH v1 0/4] Add Mediatek thermal driver for mt2712 louis.yu
2017-07-27  5:46 ` [PATCH v1 1/4] dt-bindings: thermal: Add binding document for Mediatek thermal controller louis.yu
2017-07-27  5:46 ` [PATCH v1 2/4] thermal: mediatek: add Mediatek thermal driver for mt2712 louis.yu
2017-07-27  5:46 ` [PATCH v1 3/4] thermal: mediatek: extend calibration data for mt2712 chip louis.yu
2017-07-27 15:46   ` Matthias Brugger
2017-07-31  7:21     ` Louis Yu
2017-07-27  5:46 ` [PATCH v1 4/4] thermal: mediatek: minor mtk_thermal.c cleanups louis.yu
2017-07-27 15:49   ` Matthias Brugger
2017-07-31  7:23     ` Louis Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1501485811.9219.34.camel@mtksdaap41 \
    --to=louis.yu@mediatek.com \
    --cc=dawei.chien@mediatek.com \
    --cc=eddie.huang@mediatek.com \
    --cc=edubezval@gmail.com \
    --cc=fan.chen@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=srv_heupstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox