All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Shawn Guo <shawn.guo@linaro.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Andy Gross <agross@kernel.org>,
	linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] cpufreq: qcom-hw: add missing devm_release_mem_region() call
Date: Tue, 12 Jan 2021 22:59:05 -0600	[thread overview]
Message-ID: <X/5+GbueKg66DoEE@builder.lan> (raw)
In-Reply-To: <20210113043143.y45mmnw3e2kjkxnl@vireshk-i7>

On Tue 12 Jan 22:31 CST 2021, Viresh Kumar wrote:

> On 12-01-21, 08:44, Bjorn Andersson wrote:
> > Intuitively I feel that resources allocated in cpufreq_driver->init()
> > should be explicitly freed in cpufreq_driver->exit() and should thereby
> > not use devm to track the allocations.
> 
> I agree.
> 
> > But afaict when qcom_cpufreq_hw_driver_remove() calls
> > cpufreq_unregister_driver() to end up in cpufreq_remove_dev() it will
> > only call cpufreq_driver->exit() iff cpufreq_driver->offline() is
> > implemented - which it isn't in our case.
> 
> cpufreq_offline() calls exit() in your case. So no memory leak here.
> 

Okay, so cpufreq_offline() calls exit iff there's no offline implemented
and therefor cpufreq_remove_dev() need to call exit if the other code
path was taken in cpufreq_offline()...that's...clever...

Thanks for confirming that exit() will be invoked, then we should stop
using the devm versions of the allocators.


But that said, why are the ioremap done at init and not at probe time?

Regards,
Bjorn

> > So without using devm to track
> > this we would leak the memory - which also implies that we're leaking
> > the "freq_table" when this happens.
> > 
> > But isn't that simply a typo in cpufreq_remove_dev()? And can't we just
> > use ioremap()/iounmap() here instead?
> 
> -- 
> viresh

  reply	other threads:[~2021-01-13  4:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12  9:52 [PATCH] cpufreq: qcom-hw: add missing devm_release_mem_region() call Shawn Guo
2021-01-12 10:14 ` Viresh Kumar
2021-01-12 11:19   ` Shawn Guo
2021-01-12 12:19     ` Ionela Voinescu
2021-01-12 14:44 ` Bjorn Andersson
2021-01-13  4:31   ` Viresh Kumar
2021-01-13  4:59     ` Bjorn Andersson [this message]
2021-01-13  5:06       ` Viresh Kumar
2021-01-13 22:12         ` AngeloGioacchino Del Regno
2021-01-14  4:58           ` Viresh Kumar
2021-01-14  5:21           ` Bjorn Andersson
2021-01-18  6:43         ` Viresh Kumar
2021-01-18  6:54           ` Shawn Guo
2021-01-18 11:03             ` Ionela Voinescu
2021-01-18 12:17         ` Shawn Guo
2021-01-19  3:36           ` 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=X/5+GbueKg66DoEE@builder.lan \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=shawn.guo@linaro.org \
    --cc=viresh.kumar@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.