From: David Heidelberg <david@ixit.cz>
To: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>,
Lee Jones <lee@kernel.org>,
Srinivas Kandagatla <srini@kernel.org>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mfd: wcd934x: Unroll regmap and irqchip on removal
Date: Thu, 3 Sep 2026 17:16:48 +0200 [thread overview]
Message-ID: <628ad2b7-d509-45d1-a9ab-e3cbedac9a92@ixit.cz> (raw)
In-Reply-To: <20260309-wcd934x-unroll-regmap-v1-1-9a5fb305540e@oss.qualcomm.com>
On 10/03/2026 04:53, Bjorn Andersson wrote:
> When the slimbus-up event is handled a new regmap is created, an IRQ
> chip is registered on this regmap and then the MFD devices are added.
>
> But the regmap is left dangling if either any of those operations are
> failing or if the slimbus-down event ever comes. Which manifest itself
> as an error print from debugfs once the next slimbus-up event happens.
>
> Likewise, if for some reason a slimbus-down event would be followed by
> a slimbus-up event without the MFD being torn down by the slimbus
> controller inbetween, we're going to have a dangling irq_chip.
>
> Add cleanup of the registered resources on failure and on removal.
>
> Fixes: 6ac7e4d7ad70 ("mfd: wcd934x: Add support to wcd9340/wcd9341 codec")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
> ---
> drivers/mfd/wcd934x.c | 49 ++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 38 insertions(+), 11 deletions(-)
>
What is final thought on this series?
I have feeling Sashiko pointed the problem with devm double registration still
exist, see below:
[Severity: High]
This is a pre-existing issue, but does the use of managed devres functions in
wcd934x_slim_status_up() cause memory leaks and double registrations?
drivers/mfd/wcd934x.c:wcd934x_slim_status_up() {
...
ret = devm_regmap_add_irq_chip(dev, ddata->regmap, ddata->irq,
IRQF_TRIGGER_HIGH, 0,
&wcd934x_regmap_irq_chip,
&ddata->irq_data);
...
}
wcd934x_slim_status_up() is called when the SLIMbus transitions to
SLIM_DEVICE_STATUS_UP. If the bus goes DOWN, mfd_remove_devices() is called,
but the IRQ chip added via devm_regmap_add_irq_chip() is not removed because
devres cleanup only happens on driver unbind, not on bus status changes.
When the bus transitions UP again, wouldn't the driver attempt to re-register
the IRQ chip and fail with -EBUSY, leaving the device in an unusable state?
https://lore.kernel.org/mfd/20260903145651.AC1311F00ACA@smtp.kernel.org/
David
prev parent reply other threads:[~2026-09-03 15:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 3:53 Bjorn Andersson
2026-03-10 9:13 ` Lee Jones
2026-03-11 3:20 ` Bjorn Andersson
2026-03-19 15:11 ` Lee Jones
2026-04-01 14:39 ` Bjorn Andersson
2026-04-07 13:51 ` Lee Jones
2026-09-03 15:16 ` David Heidelberg [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=628ad2b7-d509-45d1-a9ab-e3cbedac9a92@ixit.cz \
--to=david@ixit.cz \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=lee@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=srini@kernel.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
all inboxes | Powered by JetHome®