git: fafb43abd0dc - main - pci: Use a switch statement when reading ivars
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Dec 2024 18:19:02 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=fafb43abd0dcaf2d36ec7344f46e7e19c42be888
commit fafb43abd0dcaf2d36ec7344f46e7e19c42be888
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-12-12 16:30:02 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-12-12 18:00:23 +0000
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
---
sys/dev/pci/pci_host_generic.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index b47a90348388..e9a9e99b4b17 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -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);
}