Skip to contentSkip to conversation

fpga: dfl: pci: fix return value of cci_pci_sriov_configure

PATCH Applied Xu Yilun 2 participants 2 messages Feb 25, 2020 – Mar 1, 2020

Subsystems (2)
lore
Share & tools
lore

Xu Yilun

author maintainer
#0 lore raw

PATCH 1/1 fpga: dfl: pci: fix return value of cci_pci_sriov_configure

pci_driver.sriov_configure should return negative value on error and number of enabled VFs on success. But now the driver returns 0 on success. The sriov configure still works but will cause a warning message:

XX VFs requested; only 0 enabled

This patch changes the return value accordingly.

---
 drivers/fpga/dfl-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/fpga/dfl-pci.c +4 -2
index 89ca292..5387550 100644
@@ -248,11 +248,13 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs)
 			return ret;
 
 		ret = pci_enable_sriov(pcidev, num_vfs);
-		if (ret)
+		if (ret) {
 			dfl_fpga_cdev_config_ports_pf(cdev);
+			return ret;
+		}
 	}
 
-	return ret;
+	return num_vfs;
 }
 
 static void cci_pci_remove(struct pci_dev *pcidev)
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 38 lines · Xu Yilun

pci_driver.sriov_configure should return negative value on error and number of enabled VFs on success. But now the driver returns 0 on success. The sriov configure still works but will cause a warning message:

XX VFs requested; only 0 enabled

This patch changes the return value accordingly.

---
 drivers/fpga/dfl-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/fpga/dfl-pci.c +4 -2
index 89ca292..5387550 100644
@@ -248,11 +248,13 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs)
 			return ret;
 
 		ret = pci_enable_sriov(pcidev, num_vfs);
-		if (ret)
+		if (ret) {
 			dfl_fpga_cdev_config_ports_pf(cdev);
+			return ret;
+		}
 	}
 
-	return ret;
+	return num_vfs;
 }
 
 static void cci_pci_remove(struct pci_dev *pcidev)
Signature · 1 line
2.7.4

Applied to for-next,

Thanks