mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
PCI/pwrctrl: Only destroy devices created by pwrctrl core
pci_pwrctrl_create_device() only creates platform devices for OF nodes
that pci_pwrctrl_is_required() accepts, but pci_pwrctrl_destroy_device()
unregisters the platform device of every available child node without
that check.
Nodes under a PCI host controller that are not pwrctrl devices may have
been populated by another mechanism. Destroying them here would tear down
devices owned by other code.
Mirror the check done at creation time so that only devices created by the
pwrctrl core are removed.
Fixes: 4c41324892 ("PCI/pwrctrl: Add APIs to create, destroy pwrctrl devices")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/1791446700-100166-1-git-send-email-shawn.lin@rock-chips.com
This commit is contained in:
parent
ee450e3a2d
commit
7bf2ebcb7c
|
|
@ -388,6 +388,9 @@ static void pci_pwrctrl_destroy_device(struct device_node *np)
|
|||
for_each_available_child_of_node_scoped(np, child)
|
||||
pci_pwrctrl_destroy_device(child);
|
||||
|
||||
if (!pci_pwrctrl_is_required(np))
|
||||
return;
|
||||
|
||||
pdev = of_find_device_by_node(np);
|
||||
if (!pdev)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user