From: sashiko-bot@kernel.org
To: "Marek Vasut" <marek.vasut+renesas@mailbox.org>
Cc: wsa+renesas@sang-engineering.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 2/2] PCI: dwc: rcar-gen4: Use .post_deinit to handle dw_pcie_ep_init() failures
Date: Thu, 20 Aug 2026 04:10:15 +0000 [thread overview]
Message-ID: <20260820041015.90DEE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260820035944.163472-2-marek.vasut+renesas@mailbox.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing early return in dw_pcie_ep_init_registers() error path causes EPC to be incorrectly notified as ready.
--
--- Patch [2]: [PATCH v2 2/2] PCI: dwc: rcar-gen4: Use .post_deinit to handle dw_pcie_ep_init() failures ---
commit 6071cb241e93cb3a6592fddfd5caeb02f9e49fac
Author: Marek Vasut <marek.vasut+renesas@mailbox.org>
PCI: dwc: rcar-gen4: Use .post_deinit to handle dw_pcie_ep_init() failures
Implement the .post_deinit() callback in R-Car Gen4 to cleanly stop clocks
and assert resets if endpoint initialization fails. This prevents duplicate
cleanup attempts by removing explicit deinit calls from the error paths.
> diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
[ ... ]
> @@ -570,16 +576,13 @@ static int rcar_gen4_add_dw_pcie_ep(struct rcar_gen4_pcie *rcar)
> ep->ops = &pcie_ep_ops;
>
> ret = dw_pcie_ep_init(ep);
> - if (ret) {
> - rcar_gen4_pcie_ep_deinit(rcar);
> + if (ret)
> return ret;
> - }
>
> ret = dw_pcie_ep_init_registers(ep);
> if (ret) {
> dev_err(dev, "Failed to initialize DWC endpoint registers\n");
> dw_pcie_ep_deinit(ep);
> - rcar_gen4_pcie_ep_deinit(rcar);
> }
[Severity: High]
This is a pre-existing issue, but does this error path fall through and
incorrectly notify the EPC framework?
If dw_pcie_ep_init_registers() fails in rcar_gen4_add_dw_pcie_ep(), the
code de-initializes the endpoint via dw_pcie_ep_deinit(), but seems to miss
a return statement. It will unconditionally fall through and call
pci_epc_init_notify(ep->epc).
Could this cause bound Endpoint Function (EPF) drivers to receive an
initialization complete notification on a disabled controller, potentially
leading to an asynchronous external abort (SError) or kernel panic when they
attempt memory mapping and register accesses?
>
> pci_epc_init_notify(ep->epc);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260820035944.163472-1-marek.vasut+renesas@mailbox.org?part=2
next prev parent reply other threads:[~2026-08-20 4:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 3:57 [PATCH v2 1/2] PCI: dwc: Add .post_deinit counterpart to endpoint .pre_init callback Marek Vasut
2026-08-20 3:57 ` [PATCH v2 2/2] PCI: dwc: rcar-gen4: Use .post_deinit to handle dw_pcie_ep_init() failures Marek Vasut
2026-08-20 4:10 ` sashiko-bot [this message]
2026-08-20 8:11 ` Koichiro Den
2026-08-20 8:42 ` Marek Vasut
2026-08-20 4:06 ` [PATCH v2 1/2] PCI: dwc: Add .post_deinit counterpart to endpoint .pre_init callback sashiko-bot
2026-08-20 8:09 ` Koichiro Den
2026-08-20 8:20 ` Marek Vasut
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=20260820041015.90DEE1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=marek.vasut+renesas@mailbox.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.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.