vlib: deuglify the offset finding loop in pci.c

Type: style
Fixes: 054229ebbd

Change-Id: I7c3080db94566af249e5082d59a4e6373c616888
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
This commit is contained in:
Vratko Polak
2023-08-23 18:39:25 +02:00
committed by Damjan Marion
parent 4585bb121b
commit fee945940c

View File

@ -176,11 +176,7 @@ vlib_pci_function_level_reset (vlib_main_t *vm, vlib_pci_dev_handle_t h)
return err;
offset = cfg.cap_ptr;
/* Make gcc happy, otherwise gcc fails build due to cap not set if offset ==
* 0 */
cap = (pci_capability_pcie_t *) (cfg.data + offset);
while (offset)
do
{
cap = (pci_capability_pcie_t *) (cfg.data + offset);
@ -189,6 +185,7 @@ vlib_pci_function_level_reset (vlib_main_t *vm, vlib_pci_dev_handle_t h)
offset = cap->next_offset;
}
while (offset);
if (cap->capability_id != PCI_CAP_ID_PCIE)
return clib_error_return (0, "PCIe capability config not found");