Skip to contentSkip to conversation

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

PATCH In review Zhen Lei 3 participants 3 messages May 15, 2021 – May 24, 2021

Subsystems (2)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

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

The error code returned from vfio_ext_cap_len() is stored in 'len', not in 'ret'.

Fixes 89e1f7d4c66d ("vfio: Add PCI device driver")
---
 drivers/vfio/pci/vfio_pci_config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_config.c +1 -1
index d57f037f65b85d4..70e28efbc51f80e 100644
@@ -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;
 			}
 		}
 
Signature · 1 line
2.26.0.106.g9fadedd
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Zhen Lei

The error code returned from vfio_ext_cap_len() is stored in 'len', not in 'ret'.

Fixes 89e1f7d4c66d ("vfio: Add PCI device driver")
---
  drivers/vfio/pci/vfio_pci_config.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_config.c +0 -0
index d57f037f65b85d4..70e28efbc51f80e 100644

drivers/vfio/pci/vfio_pci_config.c static int vfio_ecap_init(struct vfio_pci_device *vdev) · line 1586

Quoted 7 lines
drivers/vfio/pci/vfio_pci_config.c +1 -1
@@ -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,

Quoted 1 line
#2 lore raw
In reply to Zhen Lei
Quoted 15 lines · On Sat, 15 May 2021 10:04:58 +0800 Zhen Lei <[email protected]> wrote:

The error code returned from vfio_ext_cap_len() is stored in 'len', not in 'ret'.

Fixes 89e1f7d4c66d ("vfio: Add PCI device driver")
---
 drivers/vfio/pci/vfio_pci_config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_config.c +0 -0
index d57f037f65b85d4..70e28efbc51f80e 100644

drivers/vfio/pci/vfio_pci_config.c static int vfio_ecap_init(struct vfio_pci_device *vdev) · line 1587

Quoted 8 lines
drivers/vfio/pci/vfio_pci_config.c +1 -1
@@ -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