From: Niklas Cassel <cassel@kernel.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-rockchip@lists.infradead.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 2/3] PCI: dw-rockchip: Make the INTx irq setup devm-managed
Date: Tue, 22 Sep 2026 11:58:00 +0200 [thread overview]
Message-ID: <arJRKDwpZl_Cb1zP@ryzen> (raw)
In-Reply-To: <1790044622-164744-3-git-send-email-shawn.lin@rock-chips.com>
On Tue, Sep 22, 2026 at 10:37:01AM +0800, Shawn Lin wrote:
> The irq domain and the chained handler set up by the previous commit
> are resources owned by the device, but nothing releases them if probing
> ever fails after they are set up, and they are not tied to the device
> lifetime in any other way either.
>
> Tie their lifetime to the device with devres: create the irq domain
> with devm_irq_domain_instantiate() and uninstall the chained handler
> through the rockchip_pcie_intx_chained_release() devres action. The
> driver is builtin and cannot be unbound (suppress_bind_attrs), so probe
> failure is the only path that ever needs this cleanup, and devres takes
> care of it without sprinkling it over every error path.
>
> Since the irq setup is the last step of rockchip_pcie_configure_rc(),
> the only failure point left after the chained handler is installed is
> devm_add_action_or_reset() itself, whose failure mode runs the action,
> so the handler can never run against the devm-freed rockchip structure.
> devres also unwinds in reverse registration order, so the handler is
> always uninstalled before the domain is removed. There is no devm API
> for chained handlers, hence the small devres action wrapper.
>
> While at it, drop the now unused rockchip variable from
> rockchip_pcie_host_init().
>
> Suggested-by: Niklas Cassel <cassel@kernel.org>
Thank you for giving me credit :)
Unfortunately, I don't think that I was the one who suggested this change.
I think you came up with the idea :)
Kind regards,
Niklas
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: Niklas Cassel <cassel@kernel.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-rockchip@lists.infradead.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 2/3] PCI: dw-rockchip: Make the INTx irq setup devm-managed
Date: Tue, 22 Sep 2026 11:58:00 +0200 [thread overview]
Message-ID: <arJRKDwpZl_Cb1zP@ryzen> (raw)
In-Reply-To: <1790044622-164744-3-git-send-email-shawn.lin@rock-chips.com>
On Tue, Sep 22, 2026 at 10:37:01AM +0800, Shawn Lin wrote:
> The irq domain and the chained handler set up by the previous commit
> are resources owned by the device, but nothing releases them if probing
> ever fails after they are set up, and they are not tied to the device
> lifetime in any other way either.
>
> Tie their lifetime to the device with devres: create the irq domain
> with devm_irq_domain_instantiate() and uninstall the chained handler
> through the rockchip_pcie_intx_chained_release() devres action. The
> driver is builtin and cannot be unbound (suppress_bind_attrs), so probe
> failure is the only path that ever needs this cleanup, and devres takes
> care of it without sprinkling it over every error path.
>
> Since the irq setup is the last step of rockchip_pcie_configure_rc(),
> the only failure point left after the chained handler is installed is
> devm_add_action_or_reset() itself, whose failure mode runs the action,
> so the handler can never run against the devm-freed rockchip structure.
> devres also unwinds in reverse registration order, so the handler is
> always uninstalled before the domain is removed. There is no devm API
> for chained handlers, hence the small devres action wrapper.
>
> While at it, drop the now unused rockchip variable from
> rockchip_pcie_host_init().
>
> Suggested-by: Niklas Cassel <cassel@kernel.org>
Thank you for giving me credit :)
Unfortunately, I don't think that I was the one who suggested this change.
I think you came up with the idea :)
Kind regards,
Niklas
next prev parent reply other threads:[~2026-09-22 9:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 2:36 [PATCH v3 0/3] Small INTx fixes for Rockchip's dwc based PCIe controller driver Shawn Lin
2026-09-22 2:36 ` Shawn Lin
2026-09-22 2:37 ` [PATCH v3 1/3] PCI: dw-rockchip: Move the INTx irq setup to probe Shawn Lin
2026-09-22 2:37 ` Shawn Lin
2026-09-22 2:51 ` sashiko-bot
2026-09-22 12:03 ` Niklas Cassel
2026-09-22 9:56 ` Niklas Cassel
2026-09-22 9:56 ` Niklas Cassel
2026-09-22 2:37 ` [PATCH v3 2/3] PCI: dw-rockchip: Make the INTx irq setup devm-managed Shawn Lin
2026-09-22 2:37 ` Shawn Lin
2026-09-22 2:54 ` sashiko-bot
2026-09-22 9:58 ` Niklas Cassel [this message]
2026-09-22 9:58 ` Niklas Cassel
2026-09-22 2:37 ` [PATCH v3 3/3] PCI: dw-rockchip: Mask the INTx IRQ while the controller clocks are gated Shawn Lin
2026-09-22 2:37 ` Shawn Lin
2026-09-22 2:51 ` sashiko-bot
2026-09-23 9:13 ` [PATCH v3 0/3] Small INTx fixes for Rockchip's dwc based PCIe controller driver Diederik de Haas
2026-09-23 9:13 ` Diederik de Haas
2026-09-23 9:21 ` Shawn Lin
2026-09-23 9:21 ` Shawn Lin
2026-09-23 15:25 ` Niklas Cassel
2026-09-23 15:25 ` Niklas Cassel
2026-09-24 3:27 ` Shawn Lin
2026-09-24 3:27 ` Shawn Lin
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=arJRKDwpZl_Cb1zP@ryzen \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mani@kernel.org \
--cc=shawn.lin@rock-chips.com \
/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.