summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>2019-03-22 13:27:22 -0500
committerBjorn Helgaas <bhelgaas@google.com>2019-04-10 16:07:12 -0500
commit91800660bbe9d4ae7791f0e646e5736180f01fc0 (patch)
treec23070bd2763b4994b881eb641f5273f649f7802
parentfb26228bfc4ce3951544848555c0278e2832e618 (diff)
downloadlinux-91800660bbe9d4ae7791f0e646e5736180f01fc0.tar.bz2
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: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/hotplug/rpaphp_slot.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 5282aa3e33c5..93b4a945c55d 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -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;