Commit e9c3bbd6 authored by Moritz Fischer's avatar Moritz Fischer Committed by Bjorn Helgaas
Browse files

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: default avatarBrian Foley <bpfoley@google.com>
Signed-off-by: default avatarMoritz Fischer <mdf@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarKrzysztof Wilczyński <kw@linux.com>
parent 6efb943b
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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;
	}