Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jul 2023 13:36:44 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a710a3f13da3 - stable/13 - bhyve: Deduplicate some code in modify_bar_registration()
Message-ID:  <202307181336.36IDaitY049924@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=a710a3f13da34aa5fd26eb9c6b33381aff6f38b8

commit a710a3f13da34aa5fd26eb9c6b33381aff6f38b8
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-07-11 19:22:37 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-07-18 13:36:25 +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
    
    (cherry picked from commit 0dea4f064dfcd0725d02b9b2d02b2494ca866857)
---
 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 34ce3cb7d49a..2b73d82be025 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -606,9 +606,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:
@@ -624,21 +621,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307181336.36IDaitY049924>