From: Peng Fan <peng.fan@xxxxxxx> When PCI node was created using an overlay and the overlay is reverted/destroyed, the "linux,pci-domain" property no longer exists, so of_get_pci_domain_nr will return failure. Then of_pci_bus_release_domain_nr will actually use the dynamic IDA, even if the IDA was allocated in static IDA. So move the notify before revert to fix the issue. Fixes: c14f7ccc9f5d ("PCI: Assign PCI domain IDs by ida_alloc()") Signed-off-by: Peng Fan <peng.fan@xxxxxxx> --- The initial thread: https://lore.kernel.org/all/20230913115737.GA426735@bhelgaas/ drivers/of/dynamic.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 3bf27052832f..0a5ec2bda380 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -834,13 +834,15 @@ int __of_changeset_revert_notify(struct of_changeset *ocs) static int __of_changeset_revert(struct of_changeset *ocs) { - int ret, ret_reply; + int ret, ret_reply = 0; - ret_reply = 0; - ret = __of_changeset_revert_entries(ocs, &ret_reply); + ret = __of_changeset_revert_notify(ocs); + if (ret) + return ret; - if (!ret) - ret = __of_changeset_revert_notify(ocs); + ret = __of_changeset_revert_entries(ocs, &ret_reply); + if (ret && !ret_reply) + ret = __of_changeset_apply_notify(ocs); return ret; } -- 2.37.1