Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Manivannan Sadhasivam" <mani@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 5/8] PCI/ASPM: Return enabled ASPM states from pcie_aspm_enabled() API
Date: Wed, 08 Jul 2026 14:36:52 +0000	[thread overview]
Message-ID: <20260708143653.0BB6F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-pci-aspm-fix-v3-5-6bd72451746e@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The function `pcie_aspm_enabled()` returns a boolean literal (`false`) despite its return type being changed to `u32`.
--

--- Patch [5]: [PATCH v3 5/8] PCI/ASPM: Return enabled ASPM states from pcie_aspm_enabled() API ---
commit 075855b1906924e43de63fd5d55e7d8fedc2a01b
Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

PCI/ASPM: Return enabled ASPM states from pcie_aspm_enabled() API

pcie_aspm_enabled() returns the pcie_link_state::aspm_enabled parameter which
contains the enabled states. But the API currently returns the bool type
which is used by the callers to decide if ASPM is enabled or not.

To allow the future callers to also make use of the enabled ASPM states,
this patch returns the actual type of pcie_link_state::aspm_enabled, u32.

> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 5e7e199c78d26..3ce6b93195663 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -1694,15 +1694,17 @@ module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy,
>  	NULL, 0644);
>  
>  /**
> - * pcie_aspm_enabled - Check if PCIe ASPM has been enabled for a device.
> + * pcie_aspm_enabled - Get the enabled PCIe ASPM states for a device.
>   * @pdev: Target device.
>   *
>   * Relies on the upstream bridge's link_state being valid.  The link_state
>   * is deallocated only when the last child of the bridge (i.e., @pdev or a
>   * sibling) is removed, and the caller should be holding a reference to
>   * @pdev, so this should be safe.
> + *
> + * Return: Enabled PCIe ASPM states. 0 if ASPM is disabled.
>   */
> -bool pcie_aspm_enabled(struct pci_dev *pdev)
> +u32 pcie_aspm_enabled(struct pci_dev *pdev)
>  {
>  	struct pcie_link_state *link = pcie_aspm_get_link(pdev);
>  

[Severity: Low]
Does this code still return a boolean literal on the error path?

Looking at pcie_aspm_enabled(), the error path still returns false:

    if (!link)
        return false;

Since the return type of pcie_aspm_enabled() was changed to u32, returning
false compiles because false evaluates to 0, but it obfuscates the integer
semantics of the function and might trigger static analysis warnings. Could
this be updated to return 0 instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-pci-aspm-fix-v3-0-6bd72451746e@kernel.org?part=5

  reply	other threads:[~2026-07-08 14:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 14:30 [PATCH v3 0/8] PCI/ASPM: Add pci_force_enable_link_state() API and convert Atheros drivers Manivannan Sadhasivam
2026-07-08 14:30 ` [PATCH v3 1/8] PCI/ASPM: Always disable ASPM when driver requests it Manivannan Sadhasivam
2026-07-08 14:44   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 2/8] PCI/ASPM: Add pci_force_enable_link_state() API Manivannan Sadhasivam
2026-07-08 14:44   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 3/8] PCI/ASPM: Transition the device to D0 (if required) when enabling ASPM link states Manivannan Sadhasivam
2026-07-08 14:50   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 4/8] PCI/ASPM: Improve the kernel-doc for pci_{enable,disable}_link_state*() APIs Manivannan Sadhasivam
2026-07-08 14:37   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 5/8] PCI/ASPM: Return enabled ASPM states from pcie_aspm_enabled() API Manivannan Sadhasivam
2026-07-08 14:36   ` sashiko-bot [this message]
2026-07-08 14:30 ` [PATCH v3 6/8] wifi: ath12k: Use pci_{enable/disable}_link_state() APIs to enable/disable ASPM states Manivannan Sadhasivam
2026-07-08 14:49   ` sashiko-bot
2026-07-10 20:25   ` Bjorn Helgaas
2026-07-08 14:30 ` [PATCH v3 7/8] wifi: ath11k: " Manivannan Sadhasivam
2026-07-08 14:47   ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 8/8] wifi: ath10k: " Manivannan Sadhasivam
2026-07-08 14:51   ` 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=20260708143653.0BB6F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox