Skip to content

Commit

Permalink
Merge tag 'pci-v6.13-fixes-1' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/pci/pci

Pull PCI fix from Bjorn Helgaas:

 - When removing a PCI device, only look up and remove a platform device
   if there is an associated device node for which there could be a
   platform device, to fix a merge window regression (Brian Norris)

* tag 'pci-v6.13-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
  PCI/pwrctrl: Unregister platform device only if one actually exists
  • Loading branch information
Linus Torvalds committed Dec 1, 2024
2 parents 8a6a03a + 5c8418c commit 0cb7170
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/pci/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ static void pci_free_resources(struct pci_dev *dev)

static void pci_pwrctrl_unregister(struct device *dev)
{
struct device_node *np;
struct platform_device *pdev;

pdev = of_find_device_by_node(dev_of_node(dev));
np = dev_of_node(dev);
if (!np)
return;

pdev = of_find_device_by_node(np);
if (!pdev)
return;

of_device_unregister(pdev);
of_node_clear_flag(dev_of_node(dev), OF_POPULATED);
of_node_clear_flag(np, OF_POPULATED);
}

static void pci_stop_dev(struct pci_dev *dev)
Expand Down

0 comments on commit 0cb7170

Please sign in to comment.