diff mbox series

[1/1] vfio/pci: Fix error return code in vfio_ecap_init()

Message ID 20210515020458.6771-1-thunder.leizhen@huawei.com (mailing list archive)
State New, archived
Headers show
Series [1/1] vfio/pci: Fix error return code in vfio_ecap_init() | expand

Commit Message

Zhen Lei May 15, 2021, 2:04 a.m. UTC
The error code returned from vfio_ext_cap_len() is stored in 'len', not
in 'ret'.

Fixes: 89e1f7d4c66d ("vfio: Add PCI device driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/vfio/pci/vfio_pci_config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Max Gurtovoy May 20, 2021, 4:13 p.m. UTC | #1
On 5/15/2021 5:04 AM, Zhen Lei wrote:
> The error code returned from vfio_ext_cap_len() is stored in 'len', not
> in 'ret'.
>
> Fixes: 89e1f7d4c66d ("vfio: Add PCI device driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>   drivers/vfio/pci/vfio_pci_config.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> index d57f037f65b85d4..70e28efbc51f80e 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -1581,7 +1581,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev)
>   			if (len == 0xFF) {
>   				len = vfio_ext_cap_len(vdev, ecap, epos);
>   				if (len < 0)
> -					return ret;
> +					return len;
>   			}
>   		}

Looks good,

Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>


>
Alex Williamson May 24, 2021, 7:35 p.m. UTC | #2
On Sat, 15 May 2021 10:04:58 +0800
Zhen Lei <thunder.leizhen@huawei.com> wrote:

> The error code returned from vfio_ext_cap_len() is stored in 'len', not
> in 'ret'.
> 
> Fixes: 89e1f7d4c66d ("vfio: Add PCI device driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/vfio/pci/vfio_pci_config.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> index d57f037f65b85d4..70e28efbc51f80e 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -1581,7 +1581,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev)
>  			if (len == 0xFF) {
>  				len = vfio_ext_cap_len(vdev, ecap, epos);
>  				if (len < 0)
> -					return ret;
> +					return len;
>  			}
>  		}
>  

Added to vfio for-linus branch for v5.13 w/ Max's R-b.  Thanks!

Alex
diff mbox series

Patch

diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index d57f037f65b85d4..70e28efbc51f80e 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -1581,7 +1581,7 @@  static int vfio_ecap_init(struct vfio_pci_device *vdev)
 			if (len == 0xFF) {
 				len = vfio_ext_cap_len(vdev, ecap, epos);
 				if (len < 0)
-					return ret;
+					return len;
 			}
 		}