All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: xianhutan@asrmicro.com
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI/PM: Reject invalid PMCSR when checking PME status
Date: Tue, 1 Dec 2026 11:20:07 +0100	[thread overview]
Message-ID: <aw6fVxkpUjuD3zV5@wunner.de> (raw)
In-Reply-To: <20261201072501.2340605-1-xianhutan@asrmicro.com>

On Tue, Dec 01, 2026 at 03:25:01PM +0800, xianhutan@asrmicro.com wrote:
> +++ b/drivers/pci/pci.c
> @@ -2323,6 +2323,7 @@ void pcie_clear_root_pme_status(struct pci_dev *dev)
>  bool pci_check_pme_status(struct pci_dev *dev)
>  {
>  	int pmcsr_pos;
> +	int rc;
>  	u16 pmcsr;
>  	bool ret = false;
>  
> @@ -2330,7 +2331,10 @@ bool pci_check_pme_status(struct pci_dev *dev)
>  		return false;
>  
>  	pmcsr_pos = dev->pm_cap + PCI_PM_CTRL;
> -	pci_read_config_word(dev, pmcsr_pos, &pmcsr);
> +	rc = pci_read_config_word(dev, pmcsr_pos, &pmcsr);
> +	if (rc != PCIBIOS_SUCCESSFUL || pmcsr == 0xffff)
> +		return false;
> +

You can just use PCI_POSSIBLE_ERROR() instead of checking for 0xffff.

I'm not sure whether checking the return value is necessary or useful,
usually checking for PCI_POSSIBLE_ERROR() is sufficient.

Thanks,

Lukas

  parent reply	other threads:[~2026-12-01 10:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  7:25 [PATCH] PCI/PM: Reject invalid PMCSR when checking PME status xianhutan
2026-12-01  7:32 ` sashiko-bot
2026-12-01 10:20 ` Lukas Wunner [this message]
2026-12-02  6:08   ` Xianhu Tan
2026-12-02  6:29   ` [PATCH v2] " xianhutan
2026-12-02  6:34     ` 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=aw6fVxkpUjuD3zV5@wunner.de \
    --to=lukas@wunner.de \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=xianhutan@asrmicro.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.