Skip to contentSkip to conversation

Set endpoint controller pointer to null

PATCH New Alan Mikhak 1 participant 1 message Apr 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set endpoint controller pointer to null

From: Alan Mikhak <[email protected]>

Set endpoint controller pointer to null in pci_epc_remove_epf() to avoid -EBUSY on subsequent call to pci_epc_add_epf().

Also check for null endpoint function pointer.

---
 drivers/pci/endpoint/pci-epc-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/endpoint/pci-epc-core.c +2 -1
index e4712a0..2091508 100644
@@ -519,11 +519,12 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf)
 {
 	unsigned long flags;
 
-	if (!epc || IS_ERR(epc))
+	if (!epc || IS_ERR(epc) || !epf)
 		return;
 
 	spin_lock_irqsave(&epc->lock, flags);
 	list_del(&epf->list);
+	epf->epc = NULL;
 	spin_unlock_irqrestore(&epc->lock, flags);
 }
 EXPORT_SYMBOL_GPL(pci_epc_remove_epf);
Signature · 1 line
2.7.4