summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMoritz Fischer <mdf@kernel.org>2021-03-27 20:51:40 +0300
committerBjorn Helgaas <bhelgaas@google.com>2021-06-10 23:25:38 +0300
commite9c3bbd68ec7dc5dd986f7270d9233d27b092816 (patch)
tree580ae96d66e8732643fbd95f9ccd293b3749e25e /drivers
parent6efb943b8616ec53a5e444193dccf1af9ad627b5 (diff)
downloadlinux-e9c3bbd68ec7dc5dd986f7270d9233d27b092816.tar.xz
PCI/IOV: Clarify error message for unbound devices
Be more verbose to disambiguate the error case when trying to configure SR-IOV with no driver bound vs. a driver that does not implement the .sriov_configure() callback. Link: https://lore.kernel.org/r/20210327175140.682708-1-mdf@kernel.org Reported-by: Brian Foley <bpfoley@google.com> Signed-off-by: Moritz Fischer <mdf@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Krzysztof WilczyƄski <kw@linux.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/iov.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index afc06e6ce115..5e8278a6f3b2 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -391,9 +391,16 @@ 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 SR-IOV\n");
+ ret = -ENOENT;
+ goto exit;
+ }
+
/* is PF driver loaded w/callback */
- if (!pdev->driver || !pdev->driver->sriov_configure) {
- pci_info(pdev, "Driver does not support SRIOV configuration via sysfs\n");
+ if (!pdev->driver->sriov_configure) {
+ pci_info(pdev, "driver does not support SR-IOV configuration via sysfs\n");
ret = -ENOENT;
goto exit;
}