git: 0dea4f064dfc - main - bhyve: Deduplicate some code in modify_bar_registration()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 11 Jul 2023 19:35:01 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=0dea4f064dfcd0725d02b9b2d02b2494ca866857
commit 0dea4f064dfcd0725d02b9b2d02b2494ca866857
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-07-11 19:22:37 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-07-11 19:22:37 +0000
bhyve: Deduplicate some code in modify_bar_registration()
No functional change intended.
Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40877
---
usr.sbin/bhyve/pci_emul.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
index f921abc356ec..cf6e1810aaad 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -615,9 +615,6 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration)
error = register_inout(&iop);
} else
error = unregister_inout(&iop);
- if (pe->pe_baraddr != NULL)
- (*pe->pe_baraddr)(pi, idx, registration,
- pi->pi_bar[idx].addr);
break;
case PCIBAR_MEM32:
case PCIBAR_MEM64:
@@ -633,21 +630,18 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration)
error = register_mem(&mr);
} else
error = unregister_mem(&mr);
- if (pe->pe_baraddr != NULL)
- (*pe->pe_baraddr)(pi, idx, registration,
- pi->pi_bar[idx].addr);
break;
case PCIBAR_ROM:
error = 0;
- if (pe->pe_baraddr != NULL)
- (*pe->pe_baraddr)(pi, idx, registration,
- pi->pi_bar[idx].addr);
break;
default:
error = EINVAL;
break;
}
assert(error == 0);
+
+ if (pe->pe_baraddr != NULL)
+ (*pe->pe_baraddr)(pi, idx, registration, pi->pi_bar[idx].addr);
}
static void