Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1713821

Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port()

From Thierry Reding <thierry.reding@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port()
Date 2017-08-17 13:00 +0200
Message-ID <ufqGS-3Hy-15@gated-at.bofh.it> (permalink)
References <ufiJj-6RK-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote:
> The pci_find_pcie_root_port() would return NULL if the given
> dev is already a Root Port, it looks like unfriendly to the
> PCIe Root Port device, Thierry and Bjorn suggest to let this
> function return the given dev under this circumstances.
> 
> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device")
> Suggested-by: Thierry Reding <thierry.reding@gmail.com>
> Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7e2022f..352bb53 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res)
>   */
>  struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
>  {
> -	struct pci_dev *bridge, *highest_pcie_bridge = NULL;
> +	struct pci_dev *bridge, *highest_pcie_bridge = dev;
>  
>  	bridge = pci_upstream_bridge(dev);
>  	while (bridge && pci_is_pcie(bridge)) {

I think this should actually be this change on top of a revert of commit
0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI
device"). After the above change, the previous fix will have a redundant
check because highest_pcie_bridge will never be NULL.

Let me send out that version to clarify what I mean.

Thierry

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() Ding Tianhong <dingtianhong@huawei.com> - 2017-08-17 04:30 +0200
  Re: [PATCH net] PCI: fix the return value for the  pci_find_pcie_root_port() David Miller <davem@davemloft.net> - 2017-08-17 04:50 +0200
  Re: [PATCH net] PCI: fix the return value for the  pci_find_pcie_root_port() Thierry Reding <thierry.reding@gmail.com> - 2017-08-17 13:00 +0200
    Re: [PATCH net] PCI: fix the return value for the  pci_find_pcie_root_port() Ding Tianhong <dingtianhong@huawei.com> - 2017-08-17 14:50 +0200
      Re: [PATCH net] PCI: fix the return value for the  pci_find_pcie_root_port() Thierry Reding <thierry.reding@gmail.com> - 2017-08-17 15:40 +0200
        Re: [PATCH net] PCI: fix the return value for the  pci_find_pcie_root_port() Ding Tianhong <dingtianhong@huawei.com> - 2017-08-17 15:50 +0200
  [PATCH] PCI: Allow PCI express root ports to find themselves Thierry Reding <thierry.reding@gmail.com> - 2017-08-17 13:10 +0200
    Re: [PATCH] PCI: Allow PCI express root ports to find themselves Bjorn Helgaas <helgaas@kernel.org> - 2017-08-17 19:00 +0200
    Re: [PATCH] PCI: Allow PCI express root ports to find themselves Shawn Lin <shawn.lin@rock-chips.com> - 2017-08-18 03:40 +0200
    Re: [PATCH] PCI: Allow PCI express root ports to find themselves Michael Ellerman <mpe@ellerman.id.au> - 2017-08-18 06:40 +0200
    Re: [PATCH] PCI: Allow PCI express root ports to find themselves David Miller <davem@davemloft.net> - 2017-08-19 01:20 +0200

csiph-web