diff mbox series

PCI/IOV: Clarify error message for unbound devices

Message ID 20210108220630.10863-1-mdf@kernel.org (mailing list archive)
State Superseded
Delegated to: Bjorn Helgaas
Headers show
Series PCI/IOV: Clarify error message for unbound devices | expand

Commit Message

Moritz Fischer Jan. 8, 2021, 10:06 p.m. UTC
Be more verbose to disambiguate the error case when trying to configure
SRIOV with no driver bound vs. a driver that does not implement the
SRIOV callback.

Reported-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
 drivers/pci/iov.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Krzysztof Wilczyński March 7, 2021, 5:58 p.m. UTC | #1
Hi Moritz,

[...]
> +	/* is PF driver loaded */
> +	if (!pdev->driver) {
> +		pci_info(pdev, "No driver bound to device. Cannot configure SRIOV\n");
> +		ret = -ENOENT;
> +		goto exit;
> +	}
[...]

Thank you!

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Krzysztof
diff mbox series

Patch

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 4afd4ee4f7f0..f9ecc691daf5 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -304,8 +304,15 @@  static ssize_t sriov_numvfs_store(struct device *dev,
 	if (num_vfs == pdev->sriov->num_VFs)
 		goto exit;
 
+	/* is PF driver loaded */
+	if (!pdev->driver) {
+		pci_info(pdev, "No driver bound to device. Cannot configure SRIOV\n");
+		ret = -ENOENT;
+		goto exit;
+	}
+
 	/* is PF driver loaded w/callback */
-	if (!pdev->driver || !pdev->driver->sriov_configure) {
+	if (!pdev->driver->sriov_configure) {
 		pci_info(pdev, "Driver does not support SRIOV configuration via sysfs\n");
 		ret = -ENOENT;
 		goto exit;