linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: dfl: pci: fix return value of cci_pci_sriov_configure
@ 2020-02-25  6:07 Xu Yilun
  2020-03-01 16:24 ` Moritz Fischer
  0 siblings, 1 reply; 2+ messages in thread
From: Xu Yilun @ 2020-02-25  6:07 UTC (permalink / raw)
  To: mdf, linux-fpga, linux-kernel; +Cc: Xu Yilun, Wu Hao

pci_driver.sriov_configure should return negative value on error and
number of enabled VFs on success. But now the driver returns 0 on
success. The sriov configure still works but will cause a warning
message:

  XX VFs requested; only 0 enabled

This patch changes the return value accordingly.

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Signed-off-by: Wu Hao <hao.wu@intel.com>
---
 drivers/fpga/dfl-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 89ca292..5387550 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -248,11 +248,13 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs)
 			return ret;
 
 		ret = pci_enable_sriov(pcidev, num_vfs);
-		if (ret)
+		if (ret) {
 			dfl_fpga_cdev_config_ports_pf(cdev);
+			return ret;
+		}
 	}
 
-	return ret;
+	return num_vfs;
 }
 
 static void cci_pci_remove(struct pci_dev *pcidev)
-- 
2.7.4


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

* Re: [PATCH] fpga: dfl: pci: fix return value of cci_pci_sriov_configure
  2020-02-25  6:07 [PATCH] fpga: dfl: pci: fix return value of cci_pci_sriov_configure Xu Yilun
@ 2020-03-01 16:24 ` Moritz Fischer
  0 siblings, 0 replies; 2+ messages in thread
From: Moritz Fischer @ 2020-03-01 16:24 UTC (permalink / raw)
  To: Xu Yilun; +Cc: mdf, linux-fpga, linux-kernel, Wu Hao

On Tue, Feb 25, 2020 at 02:07:18PM +0800, Xu Yilun wrote:
> pci_driver.sriov_configure should return negative value on error and
> number of enabled VFs on success. But now the driver returns 0 on
> success. The sriov configure still works but will cause a warning
> message:
> 
>   XX VFs requested; only 0 enabled
> 
> This patch changes the return value accordingly.
> 
> Signed-off-by: Xu Yilun <yilun.xu@intel.com>
> Signed-off-by: Wu Hao <hao.wu@intel.com>
> ---
>  drivers/fpga/dfl-pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> index 89ca292..5387550 100644
> --- a/drivers/fpga/dfl-pci.c
> +++ b/drivers/fpga/dfl-pci.c
> @@ -248,11 +248,13 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs)
>  			return ret;
>  
>  		ret = pci_enable_sriov(pcidev, num_vfs);
> -		if (ret)
> +		if (ret) {
>  			dfl_fpga_cdev_config_ports_pf(cdev);
> +			return ret;
> +		}
>  	}
>  
> -	return ret;
> +	return num_vfs;
>  }
>  
>  static void cci_pci_remove(struct pci_dev *pcidev)
> -- 
> 2.7.4
> 

Applied to for-next,

Thanks

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

end of thread, other threads:[~2020-03-01 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25  6:07 [PATCH] fpga: dfl: pci: fix return value of cci_pci_sriov_configure Xu Yilun
2020-03-01 16:24 ` Moritz Fischer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).