Skip to content

Commit 6bba3c0

Browse files
Dan Carpenterkwilczynski
authored andcommitted
PCI: endpoint: Fix error handling in epf_ntb_epc_cleanup()
There are two issues related to epf_ntb_epc_cleanup(): 1) It should call epf_ntb_config_sspad_bar_clear() 2) The epf_ntb_bind() function should call epf_ntb_epc_cleanup() to cleanup. I also changed the ordering a bit. Unwinding should be done in the mirror order from how they are allocated. Fixes: e35f56b ("PCI: endpoint: Support NTB transfer between RC and EP") Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]>
1 parent 8e0f5a9 commit 6bba3c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/pci/endpoint/functions/pci-epf-vntb.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,9 @@ static int epf_ntb_epc_init(struct epf_ntb *ntb)
799799
*/
800800
static void epf_ntb_epc_cleanup(struct epf_ntb *ntb)
801801
{
802-
epf_ntb_db_bar_clear(ntb);
803802
epf_ntb_mw_bar_clear(ntb, ntb->num_mws);
803+
epf_ntb_db_bar_clear(ntb);
804+
epf_ntb_config_sspad_bar_clear(ntb);
804805
}
805806

806807
#define EPF_NTB_R(_name) \
@@ -1337,7 +1338,7 @@ static int epf_ntb_bind(struct pci_epf *epf)
13371338
ret = pci_register_driver(&vntb_pci_driver);
13381339
if (ret) {
13391340
dev_err(dev, "failure register vntb pci driver\n");
1340-
goto err_bar_alloc;
1341+
goto err_epc_cleanup;
13411342
}
13421343

13431344
ret = vpci_scan_bus(ntb);
@@ -1348,6 +1349,8 @@ static int epf_ntb_bind(struct pci_epf *epf)
13481349

13491350
err_unregister:
13501351
pci_unregister_driver(&vntb_pci_driver);
1352+
err_epc_cleanup:
1353+
epf_ntb_epc_cleanup(ntb);
13511354
err_bar_alloc:
13521355
epf_ntb_config_spad_bar_free(ntb);
13531356

0 commit comments

Comments
 (0)