summaryrefslogtreecommitdiff
path: root/drivers/pci/endpoint
diff options
context:
space:
mode:
authorAlan Mikhak <alan.mikhak@sifive.com>2019-05-24 00:45:44 +0300
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2019-06-11 12:55:12 +0300
commitdb7a62482d2f6a63f36f30f62c4cbf1e53035719 (patch)
tree59c72b1d0e6025896352df61cad86f5d973f73a7 /drivers/pci/endpoint
parenta188339ca5a396acc588e5851ed7e19f66b0ebd9 (diff)
downloadlinux-db7a62482d2f6a63f36f30f62c4cbf1e53035719.tar.xz
PCI: endpoint: Set endpoint controller pointer to NULL
Set endpoint controller pointer to NULL in pci_epc_remove_epf() to avoid -EBUSY on subsequent call to pci_epc_add_epf(). Add a check for NULL endpoint function pointer. Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/pci/endpoint')
-rw-r--r--drivers/pci/endpoint/pci-epc-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index e4712a0f249c..2091508c1620 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -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);