Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thierry Reding" <thierry.reding@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH 5/9] PCI: tegra: Explicitly specify PMC instance to use
Date: Wed, 06 May 2026 20:55:30 +0000	[thread overview]
Message-ID: <20260506205531.7D863C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260506-pmc-v1-5-a6de5da7216b@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unassigned error code in tegra_pcie_get_resources() when devm_tegra_pmc_get() fails causes a kernel panic.
--

commit 03b6ac6d72e8b9fdb4c4e55b15fd0c26dfc93236
Author: Thierry Reding <treding@nvidia.com>

PCI: tegra: Explicitly specify PMC instance to use

Currently the kernel relies on a global variable to reference the PMC
context. This commit updates the driver to use an explicit lookup for
the PMC and passes that to the public PMC APIs.

> diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
> index 512309763d1fb..2c6c521e69017 100644
> --- a/drivers/pci/controller/pci-tegra.c
> +++ b/drivers/pci/controller/pci-tegra.c

[ ... ]

> @@ -1432,6 +1436,12 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
>  		return err;
>  	}
>  
> +	pcie->pmc = devm_tegra_pmc_get(dev);
> +	if (IS_ERR(pcie->pmc)) {
> +		dev_err_probe(dev, PTR_ERR(pcie->pmc), "failed to get PMC\n");
> +		return err;

Does this code accidentally return success when devm_tegra_pmc_get() fails?

If devm_tegra_pmc_get() returns an error pointer, the error path is taken,
but err is not updated. Looking earlier in tegra_pcie_get_resources(), err
is 0 from the successful call to tegra_pcie_resets_get().

If the function returns 0, probe will continue with an error pointer
stored in pcie->pmc.

Later, when tegra_pcie_power_on() calls tegra_pmc_powergate_power_off(),
will it dereference this error pointer and cause a kernel panic?

Should this return the result of dev_err_probe() instead?

> +	}
> +
>  	if (soc->program_uphy) {
>  		err = tegra_pcie_phys_get(pcie);
>  		if (err < 0) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260506-pmc-v1-0-a6de5da7216b@nvidia.com?part=5

  reply	other threads:[~2026-05-06 20:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 13:41 [PATCH 0/9] soc/tegra: pmc: Clean up legacy code Thierry Reding
2026-05-06 13:41 ` [PATCH 1/9] ata: ahci_tegra: Explicitly specify PMC instance to use Thierry Reding
2026-05-06 13:54   ` Damien Le Moal
2026-05-06 13:41 ` [PATCH 2/9] drm/nouveau: tegra: " Thierry Reding
2026-05-06 13:41 ` [PATCH 3/9] drm/tegra: " Thierry Reding
2026-05-06 20:41   ` sashiko-bot
2026-05-06 13:41 ` [PATCH 4/9] media: vde: " Thierry Reding
2026-05-06 13:41 ` [PATCH 5/9] PCI: tegra: " Thierry Reding
2026-05-06 20:55   ` sashiko-bot [this message]
2026-05-06 13:41 ` [PATCH 6/9] usb: xhci: " Thierry Reding
2026-05-06 13:41 ` [PATCH 7/9] soc/tegra: pmc: Create PMC context dynamically Thierry Reding
2026-05-06 21:40   ` sashiko-bot
2026-05-06 13:41 ` [PATCH 8/9] soc/tegra: pmc: Remove unused legacy functions Thierry Reding
2026-05-06 13:42 ` [PATCH 9/9] soc/tegra: pmc: Move legacy code behind CONFIG_ARM guard Thierry Reding
2026-05-06 22:37   ` sashiko-bot

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=20260506205531.7D863C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    --cc=thierry.reding@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