pci: Use a switch statement when reading ivars

In pci_host_generic.c use a switch statement rather than a series
of if statements.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48045

(cherry picked from commit fafb43abd0dcaf2d36ec7344f46e7e19c42be888)
This commit is contained in:
Andrew Turner 2024-12-12 16:30:02 +00:00 committed by Colin Percival
parent 3af851edd0
commit d3916945e4

View file

@ -369,13 +369,11 @@ generic_pcie_read_ivar(device_t dev, device_t child, int index,
struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev);
if (index == PCIB_IVAR_BUS) {
switch (index) {
case PCIB_IVAR_BUS:
*result = sc->bus_start;
return (0);
}
if (index == PCIB_IVAR_DOMAIN) {
case PCIB_IVAR_DOMAIN:
*result = sc->ecam;
return (0);
}