[PATCH v4 11/31] bus/pci: remove shadowed variables

Bruce Richardson
2026-01-14T15:46:25Z

Remove two instances where we had duplicate shadowed local variables
called "ret". In each case, we could just remove the inner instance,
since the outer value was not needing to be preserved.

Fixes: 03ba15ca65c1 ("vfio: allow mapping MSI-X BARs if kernel allows it")
Fixes: c0ce0577e84d ("pci: consolidate address comparisons")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/bus/pci/linux/pci.c | 1 -
drivers/bus/pci/linux/pci_vfio.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 66d7e09a6e..2ffac82e94 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -326,7 +326,6 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
rte_pci_add_device(dev);
} else {
struct rte_pci_device *dev2;
- int ret;

TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) {
ret = rte_pci_addr_cmp(&dev->addr, &dev2->addr);
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 8562fdcc6b..242f567ed7 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -797,7 +797,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
}
/* if we found our MSI-X BAR region, check if we can mmap it */
if (vfio_res->msix_table.bar_index != -1) {
- int ret = pci_vfio_msix_is_mappable(vfio_dev_fd,
+ ret = pci_vfio_msix_is_mappable(vfio_dev_fd,
vfio_res->msix_table.bar_index);
if (ret < 0) {
PCI_LOG(ERR, "Couldn't check if MSI-X BAR is mappable");
--
2.51.0