Skip to content

Commit

Permalink
PCI/IOV: Clarify error message for unbound devices
Browse files Browse the repository at this point in the history
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/[email protected]
Reported-by: Brian Foley <[email protected]>
Signed-off-by: Moritz Fischer <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Reviewed-by: Krzysztof Wilczyński <[email protected]>
  • Loading branch information
mfischer authored and bjorn-helgaas committed Jun 10, 2021
1 parent 6efb943 commit e9c3bbd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/pci/iov.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e9c3bbd

Please sign in to comment.