public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Chen-Yu Tsai <wenst@chromium.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	linux-pm@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Jia-Wei Chang <jia-wei.chang@mediatek.com>,
	Rex-BC Chen <rex-bc.chen@mediatek.com>
Subject: Re: [PATCH] cpufreq: mediatek: fix device leak on probe failure
Date: Tue, 9 Sep 2025 12:03:54 +0200	[thread overview]
Message-ID: <aL_7ituSjf5a0p_U@hovoldconsulting.com> (raw)
In-Reply-To: <CAGXv+5EcnLJHG_50mYb2YB0_q1XOztF84c9tAJJfKZxSCWuUCQ@mail.gmail.com>

On Tue, Sep 09, 2025 at 05:57:45PM +0800, Chen-Yu Tsai wrote:
> On Tue, Sep 9, 2025 at 5:40 PM Johan Hovold <johan@kernel.org> wrote:
> >
> > Make sure to drop the reference to the cci device taken by
> > of_find_device_by_node() on probe failure (e.g. probe deferral).

> > @@ -552,6 +554,10 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
> >  out_free_mux_clock:
> >         clk_put(info->cpu_clk);
> >
> > +out_put_cci_dev:
> > +       if (info->soc_data->ccifreq_supported)
> > +               put_device(info->cci_dev);
> 
> put_device() has a check for NULL, so the if isn't really needed.

I know, but this follows the pattern currently used by the driver (e.g.
for regulator_put()) and avoids relying on the caller having cleared the
info struct.

> Either way,
> 
> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

Thanks for reviewing.

Johan

  reply	other threads:[~2025-09-09 10:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09  7:38 [PATCH] cpufreq: mediatek: fix device leak on probe failure Johan Hovold
2025-09-09  8:01 ` AngeloGioacchino Del Regno
2025-09-09  9:57 ` Chen-Yu Tsai
2025-09-09 10:03   ` Johan Hovold [this message]
2025-09-17 12:50 ` Johan Hovold
2025-09-29  9:11 ` Viresh Kumar

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=aL_7ituSjf5a0p_U@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=jia-wei.chang@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rex-bc.chen@mediatek.com \
    --cc=viresh.kumar@linaro.org \
    --cc=wenst@chromium.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