From: Frank Li <Frank.li@oss.nxp.com>
To: Tomasz Unger <tomasz.unger@yahoo.pl>
Cc: Vinod Koul <vkoul@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Frank Li <Frank.Li@kernel.org>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
dmaengine@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] dmaengine: bcm2835-dma: Add missing of_dma_controller_free()
Date: Wed, 18 Nov 2026 20:48:46 -0600 [thread overview]
Message-ID: <av5gYARSM54QKjxm@SMW015318> (raw)
In-Reply-To: <20261118222230.123431-1-tomasz.unger@yahoo.pl>
On Wed, Nov 18, 2026 at 11:22:30PM +0100, Tomasz Unger wrote:
> [You don't often get email from tomasz.unger@yahoo.pl. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> On Wed, Nov 18, 2026 at 01:43:05PM -0600, Frank Li wrote:
> > On Sun, Nov 15, 2026 at 11:15:15PM +0100, Tomasz Unger wrote:
> >> @@ -1027,6 +1029,7 @@ static void bcm2835_dma_remove(struct platform_device *pdev)
> >> {
> >> struct bcm2835_dmadev *od = platform_get_drvdata(pdev);
> >>
> >> + of_dma_controller_free(pdev->dev.of_node);
> >
> > use devm_of_dma_controller_register() to fix this problem
>
> Hi Frank,
>
> Thanks for the review. I tried that, but with only the OF registration
> moved to devres, the controller entry is removed after
> bcm2835_dma_remove() has returned, i.e. after
> dma_async_device_unregister() and bcm2835_dma_free().
>
> In that window bcm2835_dma_xlate() can still be reached through the
> node. dma_async_device_unregister() has already freed chan->local and
> dropped the last device reference (dma_device_release() does
> list_del_rcu(&device->global_node)), while the channels stay on
> od->ddev.channels until bcm2835_dma_free(). A client requesting a
> channel at that point goes through find_candidate(), dma_chan_get()
> fails with -ENODEV and global_node is deleted a second time. The same
> applies to the dma_async_device_register() error path in probe.
>
> Doing it right with devres would mean converting the whole teardown:
> a devm action for bcm2835_dma_free(), dmaenginem_async_device_register(),
> and devm_of_dma_controller_register() last, so that the OF entry is
> removed first. That is a larger change, and
> devm_of_dma_controller_register() only exists since v7.1, while this
> fixes a bug from the original driver and is tagged for stable.
>
> So I would prefer to keep this patch as a minimal fix that backports
> cleanly, and send the devres conversion as a separate follow-up.
> Would that work for you?
Please send out follow up patch also because this is not urgent. DMA engine
driver was seldom removed.
Frank
>
> Thanks,
> Tomasz
prev parent reply other threads:[~2026-11-19 2:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261115-bcm2835-dma-of-dma-free-v1-1-d539234bfec5.ref@yahoo.pl>
2026-11-15 22:15 ` Tomasz Unger
2026-11-18 19:43 ` Frank Li
2026-11-18 22:22 ` Tomasz Unger
2026-11-19 2:48 ` Frank Li [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=av5gYARSM54QKjxm@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dmaengine@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=stable@vger.kernel.org \
--cc=tomasz.unger@yahoo.pl \
--cc=vkoul@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®