The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Ashish Kalra <Ashish.Kalra@amd.com>
Cc: bhelgaas@google.com, ilpo.jarvinen@linux.intel.com,
	alex.williamson@redhat.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: fix bug introduced in pci_save_pcix_state()
Date: Mon, 24 Feb 2025 09:43:09 -0600	[thread overview]
Message-ID: <20250224154309.GA465854@bhelgaas> (raw)
In-Reply-To: <20250223050700.4635-1-Ashish.Kalra@amd.com>

On Sun, Feb 23, 2025 at 05:07:00AM +0000, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@amd.com>
> 
> For PCIe devices which don't have PCI_CAP_ID_PCIX, this change in
> pci_save_pcix_state() causes pci_save_state() to return -ENOMEM error
> and causes e1000e driver probe to fail as follows:
> ..
> [   15.891676] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
> [   15.921816] e1000e 0000:21:00.0: probe with driver e1000e failed with error -12
> ...
> 
> Fixes: 7d90d8d2bb1b ("PCI: Avoid pointless capability searches")
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>

I dropped that patch for now, so if you're using current -next you
shouldn't see this issue.

> ---
>  drivers/pci/pci.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index ccd029339079..685463ea392b 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1743,14 +1743,14 @@ static int pci_save_pcix_state(struct pci_dev *dev)
>  	struct pci_cap_saved_state *save_state;
>  	u8 pos;
>  
> -	save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
> -	if (!save_state)
> -		return -ENOMEM;
> -
>  	pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
>  	if (!pos)
>  		return 0;
>  
> +	save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
> +	if (!save_state)
> +		return -ENOMEM;
> +
>  	pci_read_config_word(dev, pos + PCI_X_CMD,
>  			     (u16 *)save_state->cap.data);
>  
> -- 
> 2.34.1
> 

      reply	other threads:[~2025-02-24 15:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-23  5:07 [PATCH] PCI: fix bug introduced in pci_save_pcix_state() Ashish Kalra
2025-02-24 15:43 ` Bjorn Helgaas [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=20250224154309.GA465854@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=Ashish.Kalra@amd.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.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