All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND v2] PCI/IOV: Clarify error message for unbound devices
@ 2021-03-27 17:51 Moritz Fischer
  2021-05-27 23:12 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Moritz Fischer @ 2021-03-27 17:51 UTC (permalink / raw)
  To: bhelgaas
  Cc: linux-pci, linux-kernel, moritzf, Moritz Fischer, Brian Foley,
	Krzysztof Wilczyński

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>
Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
Changes from v1:
- Added Krzysztof's Reviewed-by
---
 drivers/pci/iov.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND v2] PCI/IOV: Clarify error message for unbound devices
  2021-03-27 17:51 [PATCH RESEND v2] PCI/IOV: Clarify error message for unbound devices Moritz Fischer
@ 2021-05-27 23:12 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2021-05-27 23:12 UTC (permalink / raw)
  To: Moritz Fischer
  Cc: bhelgaas, linux-pci, linux-kernel, moritzf, Brian Foley,
	Krzysztof Wilczyński

On Sat, Mar 27, 2021 at 10:51:40AM -0700, Moritz Fischer wrote:
> 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>
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>

Applied to pci/virtualization for v5.14, thanks!

> ---
> Changes from v1:
> - Added Krzysztof's Reviewed-by
> ---
>  drivers/pci/iov.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> 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;
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-27 23:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 17:51 [PATCH RESEND v2] PCI/IOV: Clarify error message for unbound devices Moritz Fischer
2021-05-27 23:12 ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.