Skip to content

Commit 721f24e

Browse files
author
Fox Snowpatch
committed
1 parent 7170d5d commit 721f24e

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

drivers/pci/controller/pci-mvebu.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
14521452
struct mvebu_pcie *pcie;
14531453
struct pci_host_bridge *bridge;
14541454
struct device_node *np = dev->of_node;
1455-
struct device_node *child;
14561455
int num, i, ret;
14571456

14581457
bridge = devm_pci_alloc_host_bridge(dev, sizeof(struct mvebu_pcie));
@@ -1474,16 +1473,14 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
14741473
return -ENOMEM;
14751474

14761475
i = 0;
1477-
for_each_available_child_of_node(np, child) {
1476+
for_each_available_child_of_node_scoped(np, child) {
14781477
struct mvebu_pcie_port *port = &pcie->ports[i];
14791478

14801479
ret = mvebu_pcie_parse_port(pcie, port, child);
1481-
if (ret < 0) {
1482-
of_node_put(child);
1480+
if (ret < 0)
14831481
return ret;
1484-
} else if (ret == 0) {
1482+
else if (ret == 0)
14851483
continue;
1486-
}
14871484

14881485
port->dn = child;
14891486
i++;
@@ -1493,6 +1490,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
14931490
for (i = 0; i < pcie->nports; i++) {
14941491
struct mvebu_pcie_port *port = &pcie->ports[i];
14951492
int irq = port->intx_irq;
1493+
struct device_node *child;
14961494

14971495
child = port->dn;
14981496
if (!child)

drivers/pci/hotplug/pnv_php.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,24 +215,19 @@ static void pnv_php_reverse_nodes(struct device_node *parent)
215215
static int pnv_php_populate_changeset(struct of_changeset *ocs,
216216
struct device_node *dn)
217217
{
218-
struct device_node *child;
219-
int ret = 0;
218+
int ret;
220219

221-
for_each_child_of_node(dn, child) {
220+
for_each_child_of_node_scoped(dn, child) {
222221
ret = of_changeset_attach_node(ocs, child);
223-
if (ret) {
224-
of_node_put(child);
225-
break;
226-
}
222+
if (ret)
223+
return ret;
227224

228225
ret = pnv_php_populate_changeset(ocs, child);
229-
if (ret) {
230-
of_node_put(child);
231-
break;
232-
}
226+
if (ret)
227+
return ret;
233228
}
234229

235-
return ret;
230+
return 0;
236231
}
237232

238233
static void *pnv_php_add_one_pdn(struct device_node *dn, void *data)

drivers/pci/hotplug/rpaphp_slot.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ EXPORT_SYMBOL_GPL(rpaphp_deregister_slot);
8282
int rpaphp_register_slot(struct slot *slot)
8383
{
8484
struct hotplug_slot *php_slot = &slot->hotplug_slot;
85-
struct device_node *child;
8685
u32 my_index;
8786
int retval;
8887
int slotno = -1;
@@ -97,11 +96,10 @@ int rpaphp_register_slot(struct slot *slot)
9796
return -EAGAIN;
9897
}
9998

100-
for_each_child_of_node(slot->dn, child) {
99+
for_each_child_of_node_scoped(slot->dn, child) {
101100
retval = of_property_read_u32(child, "ibm,my-drc-index", &my_index);
102101
if (my_index == slot->index) {
103102
slotno = PCI_SLOT(PCI_DN(child)->devfn);
104-
of_node_put(child);
105103
break;
106104
}
107105
}

0 commit comments

Comments
 (0)