goto err_unlock;
        }
 
-       err = nfp_app_sriov_enable(pf->app, num_vfs);
+       err = pci_enable_sriov(pdev, num_vfs);
        if (err) {
-               dev_warn(&pdev->dev, "App specific PCI sriov configuration failed: %d\n",
-                        err);
+               dev_warn(&pdev->dev, "Failed to enable PCI SR-IOV: %d\n", err);
                goto err_unlock;
        }
 
-       err = pci_enable_sriov(pdev, num_vfs);
+       err = nfp_app_sriov_enable(pf->app, num_vfs);
        if (err) {
-               dev_warn(&pdev->dev, "Failed to enable PCI sriov: %d\n", err);
-               goto err_app_sriov_disable;
+               dev_warn(&pdev->dev,
+                        "App specific PCI SR-IOV configuration failed: %d\n",
+                        err);
+               goto err_sriov_disable;
        }
 
        pf->num_vfs = num_vfs;
        mutex_unlock(&pf->lock);
        return num_vfs;
 
-err_app_sriov_disable:
-       nfp_app_sriov_disable(pf->app);
+err_sriov_disable:
+       pci_disable_sriov(pdev);
 err_unlock:
        mutex_unlock(&pf->lock);
        return err;
        return 0;
 }
 
-static int __nfp_pcie_sriov_disable(struct pci_dev *pdev)
+static int nfp_pcie_sriov_disable(struct pci_dev *pdev)
 {
 #ifdef CONFIG_PCI_IOV
        struct nfp_pf *pf = pci_get_drvdata(pdev);
 
+       mutex_lock(&pf->lock);
+
        /* If the VFs are assigned we cannot shut down SR-IOV without
         * causing issues, so just leave the hardware available but
         * disabled
         */
        if (pci_vfs_assigned(pdev)) {
                dev_warn(&pdev->dev, "Disabling while VFs assigned - VFs will not be deallocated\n");
+               mutex_unlock(&pf->lock);
                return -EPERM;
        }
 
 
        pci_disable_sriov(pdev);
        dev_dbg(&pdev->dev, "Removed VFs.\n");
-#endif
-       return 0;
-}
 
-static int nfp_pcie_sriov_disable(struct pci_dev *pdev)
-{
-       struct nfp_pf *pf = pci_get_drvdata(pdev);
-       int err;
-
-       mutex_lock(&pf->lock);
-       err = __nfp_pcie_sriov_disable(pdev);
        mutex_unlock(&pf->lock);
-
-       return err;
+#endif
+       return 0;
 }
 
 static int nfp_pcie_sriov_configure(struct pci_dev *pdev, int num_vfs)
 
        devlink = priv_to_devlink(pf);
 
+       nfp_net_pci_remove(pf);
+
        nfp_pcie_sriov_disable(pdev);
        pci_sriov_set_totalvfs(pf->pdev, 0);
 
-       nfp_net_pci_remove(pf);
-
        devlink_unregister(devlink);
 
        kfree(pf->rtbl);