From 703a8674dfc4717bd56a04d9354dc259bcb9d8f6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 30 Dec 2024 10:42:20 +0000 Subject: [PATCH] Revert "PCI: endpoint: Clear secondary (not primary) EPC in pci_epc_remove_epf()" This reverts commit 3c2a6d4d020c38450e8b3a7b932f21289ace2777 which is commit 688d2eb4c6fcfdcdaed0592f9df9196573ff5ce2 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ie3855bc8646589ff198399f6c3f80c14f4e05d2a Signed-off-by: Greg Kroah-Hartman --- drivers/pci/endpoint/pci-epc-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index f5a5ec80d194..6cce430d431b 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -664,18 +664,18 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf, if (!epc || IS_ERR(epc) || !epf) return; - mutex_lock(&epc->list_lock); if (type == PRIMARY_INTERFACE) { func_no = epf->func_no; list = &epf->list; - epf->epc = NULL; } else { func_no = epf->sec_epc_func_no; list = &epf->sec_epc_list; - epf->sec_epc = NULL; } + + mutex_lock(&epc->list_lock); clear_bit(func_no, &epc->function_num_map); list_del(list); + epf->epc = NULL; mutex_unlock(&epc->list_lock); } EXPORT_SYMBOL_GPL(pci_epc_remove_epf);