From: sashiko-bot@kernel.org
To: "Linmao Li" <lilinmao@kylinos.cn>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: cadence: Store the core controller in platform drvdata
Date: Tue, 15 Sep 2026 03:11:14 +0000 [thread overview]
Message-ID: <20260915031114.A49921F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915030044.4019259-1-lilinmao@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] pci: redundant devm_kzalloc of cdns_plat_pcie
--
commit 39b7fc87ca3505b497481f44dd0a65579dc50f60
Author: Linmao Li <lilinmao@kylinos.cn>
PCI: cadence: Store the core controller in platform drvdata
This commit updates cdns_plat_pcie_probe() to store the wrapped
struct cdns_pcie pointer directly in the platform drvdata. This prevents
suspend/resume callbacks from incorrectly casting the pointer and
reading beyond the wrapper structure.
> diff --git a/drivers/pci/controller/cadence/pcie-cadence-plat.c b/drivers/pci/controller/cadence/pcie-cadence-plat.c
> index 13edc6be21f59..7fef237cdbb74 100644
> --- a/drivers/pci/controller/cadence/pcie-cadence-plat.c
> +++ b/drivers/pci/controller/cadence/pcie-cadence-plat.c
> @@ -55,7 +55,6 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev)
> if (!cdns_plat_pcie)
> return -ENOMEM;
[Severity: Low]
Does this code leave behind a completely redundant memory allocation?
Since the patch changes the driver to store the inner pcie pointer directly
instead of the cdns_plat_pcie wrapper, the prior allocation of
struct cdns_plat_pcie appears to be completely unnecessary now.
> - platform_set_drvdata(pdev, cdns_plat_pcie);
> if (is_rc) {
> if (!IS_ENABLED(CONFIG_PCIE_CADENCE_PLAT_HOST))
> return -ENODEV;
[ ... ]
> @@ -114,6 +113,8 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev)
> goto err_init;
> }
>
> + platform_set_drvdata(pdev, cdns_plat_pcie->pcie);
> +
[Severity: Low]
Because only the internal pointer is saved here, does this permanently
orphan the allocated container structure from external access?
The cdns_plat_pcie structure is no longer exposed outside of the local
scope of cdns_plat_pcie_probe(), rendering the structure as dead code.
> return 0;
>
> err_init:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915030044.4019259-1-lilinmao@kylinos.cn?part=1
next prev parent reply other threads:[~2026-09-15 3:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 3:00 [PATCH] PCI: cadence: Store the core controller in platform drvdata Linmao Li
2026-09-15 3:11 ` sashiko-bot [this message]
2026-09-15 5:52 ` Aksh Garg
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=20260915031114.A49921F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lilinmao@kylinos.cn \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.