Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91800660 authored by Tyrel Datwyler's avatar Tyrel Datwyler Committed by Bjorn Helgaas
Browse files

PCI: rpaphp: Get/put device node reference during slot alloc/dealloc



When allocating the slot structure we store a pointer to the associated
device_node.  We really should be incrementing the reference count, so add
an of_node_get() during slot alloc and an of_node_put() during slot
dealloc.

Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent fb26228b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
/* free up the memory used by a slot */
void dealloc_slot_struct(struct slot *slot)
{
	of_node_put(slot->dn);
	kfree(slot->name);
	kfree(slot);
}
@@ -36,7 +37,7 @@ struct slot *alloc_slot_struct(struct device_node *dn,
	slot->name = kstrdup(drc_name, GFP_KERNEL);
	if (!slot->name)
		goto error_slot;
	slot->dn = dn;
	slot->dn = of_node_get(dn);
	slot->index = drc_index;
	slot->power_domain = power_domain;
	slot->hotplug_slot.ops = &rpaphp_hotplug_slot_ops;