Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tyrel Datwyler and committed by
Bjorn Helgaas
91800660 fb26228b

+2 -1
+2 -1
drivers/pci/hotplug/rpaphp_slot.c
··· 21 21 /* free up the memory used by a slot */ 22 22 void dealloc_slot_struct(struct slot *slot) 23 23 { 24 + of_node_put(slot->dn); 24 25 kfree(slot->name); 25 26 kfree(slot); 26 27 } ··· 37 36 slot->name = kstrdup(drc_name, GFP_KERNEL); 38 37 if (!slot->name) 39 38 goto error_slot; 40 - slot->dn = dn; 39 + slot->dn = of_node_get(dn); 41 40 slot->index = drc_index; 42 41 slot->power_domain = power_domain; 43 42 slot->hotplug_slot.ops = &rpaphp_hotplug_slot_ops;