Linux Power Management development
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: "Ondřej Jirman" <megi@xff.cz>,
	"Vasily Khoruzhick" <anarsoul@gmail.com>,
	"Yangtao Li" <tiny.windzz@gmail.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Amit Kucheria" <amitk@kernel.org>,
	"Zhang Rui" <rui.zhang@intel.com>, "Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev
Subject: Re: [PATCH] thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe()
Date: Sun, 14 May 2023 19:32:54 +0200	[thread overview]
Message-ID: <61d3dac0-550c-70bd-daf8-352e903de36d@wanadoo.fr> (raw)
In-Reply-To: <qatlg75vf4tbugut2xehwbv4722uklprr36lvsgtcdmgoiqwgi@mdsaurbgy6jz>

Le 14/05/2023 à 19:10, Ondřej Jirman a écrit :
> On Sun, May 14, 2023 at 07:00:34PM +0200, Christophe JAILLET wrote:
>>
>> Le 14/05/2023 à 17:35, Ondřej Jirman a écrit :
>>> Hello Christophe,
>>>
>>> [...]
>>>
>>> This changes the recommeded order of reset release/clock enable steps, eg. A64
>>> manual says:
>>>
>>> 	3.3.6.4. Gating and reset
>>>
>>> 	Make sure that the reset signal has been released before the release of
>>> 	module clock gating;
>>
>> Ok, so moving reset_control_deassert() (and my proposed

                  ^^^^^^^^^^^^^^^^^^^^^^

>> devm_add_action_or_reset()) just after devm_reset_control_get() should keep
>> the expected order, right?
> 
> That would be after reset_control_deassert(). devm_reset_control_get() is just
> resource management, like devm_clk_get().

Not sure to get your point. I think you misunderstood what I tried to say.


I propose to move reset_control_deassert() in a v2. And have 
devm_add_action_or_reset() just after it.

Something like:

	if (tmdev->chip->has_bus_clk_reset) {
		tmdev->reset = devm_reset_control_get(dev, NULL);
		if (IS_ERR(tmdev->reset))
			return PTR_ERR(tmdev->reset);

		ret = reset_control_deassert(tmdev->reset);
		if (ret)
			return ret;

		ret = devm_add_action_or_reset(dev, sun8i_ths_reset_control_assert,
					       tmdev->reset);
		if (ret)
			return ret;

		tmdev->bus_clk = devm_clk_get_enabled(&pdev->dev, "bus");
		if (IS_ERR(tmdev->bus_clk))
			return PTR_ERR(tmdev->bus_clk);
	}

	if (tmdev->chip->has_mod_clk) {
		tmdev->mod_clk = devm_clk_get_enabled(&pdev->dev, "mod");
		if (IS_ERR(tmdev->mod_clk))
			return PTR_ERR(tmdev->mod_clk);
	}

	ret = clk_set_rate(tmdev->mod_clk, 24000000);
	if (ret)
		return ret;


This would keep the order of operation, still fix the leak in the probe 
and still save some LoC.

Would it make it?

CJ

> 
> regards,
> 	o.
> 


  reply	other threads:[~2023-05-14 17:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-14 15:21 [PATCH] thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe() Christophe JAILLET
2023-05-14 15:35 ` Ondřej Jirman
2023-05-14 17:00   ` Christophe JAILLET
2023-05-14 17:10     ` Ondřej Jirman
2023-05-14 17:32       ` Christophe JAILLET [this message]
2023-05-14 17:44         ` Ondřej Jirman

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=61d3dac0-550c-70bd-daf8-352e903de36d@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=amitk@kernel.org \
    --cc=anarsoul@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=megi@xff.cz \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=samuel@sholland.org \
    --cc=tiny.windzz@gmail.com \
    --cc=wens@csie.org \
    /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