]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
vfio/pci: Fix error return code in vfio_ecap_init()
authorZhen Lei <thunder.leizhen@huawei.com>
Sat, 15 May 2021 02:04:58 +0000 (10:04 +0800)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 24 May 2021 18:14:18 +0000 (12:14 -0600)
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>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Message-Id: <20210515020458.6771-1-thunder.leizhen@huawei.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_config.c

index d57f037f65b85d48942e17a659e9bb7bc0fd137d..70e28efbc51f80e04b87edd010d8d27799795cca 100644 (file)
@@ -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;
                        }
                }