Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: iproc: platform: use device functions instead of OF.
Date: Sun, 26 Jul 2026 22:05:45 +0000	[thread overview]
Message-ID: <20260726220545.CCC821F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260726215558.34091-1-rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The arguments `type` and `num` are swapped in the call to `platform_get_resource`, causing it to always return NULL.
--

--- Patch [1]: [PATCH] PCI: iproc: platform: use device functions instead of OF. ---
commit 2f0a3f1eb1db2f4c07d6f4eed3d9de0ee3b5177e
Author: Rosen Penev <rosenp@gmail.com>

PCI: iproc: platform: use device functions instead of OF.

This commit updates the iProc PCIe platform driver to use generic device
properties and functions instead of relying directly on OF-specific APIs.
The corresponding OF header inclusions are also removed.

> diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c
> index 4c9a0c4bb923e..abd04a05fbfff 100644
> --- a/drivers/pci/controller/pcie-iproc-platform.c
> +++ b/drivers/pci/controller/pcie-iproc-platform.c

[ ... ]

> @@ -40,11 +36,14 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct iproc_pcie *pcie;
> -	struct device_node *np = dev->of_node;
> -	struct resource reg;
> +	struct resource *reg;
>  	struct pci_host_bridge *bridge;
>  	int ret;
>  
> +	reg = platform_get_resource(pdev, 0, IORESOURCE_MEM);

[Severity: High]
Are the type and num arguments swapped in this call to
platform_get_resource()?

Looking at platform_get_resource(), its signature expects the resource type
followed by the resource index:

struct resource *platform_get_resource(struct platform_device *dev,
                                       unsigned int type, unsigned int num)

Passing 0 as the type and IORESOURCE_MEM as the num means this will attempt
to retrieve the 512th resource of type 0. This will consistently return NULL
and cause the driver probe to unconditionally fail with -ENODEV.

Would it be correct to use platform_get_resource(pdev, IORESOURCE_MEM, 0)
here instead?

> +	if (!reg)
> +		return -ENODEV;
> +
>  	bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260726215558.34091-1-rosenp@gmail.com?part=1

      reply	other threads:[~2026-07-26 22:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-26 21:55 [PATCH] PCI: iproc: platform: use device functions instead of OF Rosen Penev
2026-07-26 22:05 ` sashiko-bot [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=20260726220545.CCC821F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rosenp@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox