|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/vMSI: avoid "goto" in msixtbl_pt_unregister()
commit 83d55dca3a2a0e68db768a3c4de241f249ec99aa
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Oct 29 09:11:36 2026 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Oct 29 09:11:36 2026 +0100
x86/vMSI: avoid "goto" in msixtbl_pt_unregister()
"goto" can be helpful in certain situations, yet where easily possible I
think it's better to avoid its use. With the re-arrangement also restrict
the scop of two of the local variables, and add const to one of them.
No functional changed intended.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
---
xen/arch/x86/hvm/vmsi.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index ccaf42af37..4d8d122a8c 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -688,8 +688,6 @@ void msixtbl_pt_unregister(struct domain *d, struct pirq
*pirq)
{
struct irq_desc *irqd;
struct msi_desc *msi_desc;
- struct pci_dev *pdev;
- struct msixtbl_entry *entry;
ASSERT(rw_is_locked(&d->pci_lock));
ASSERT(rw_is_write_locked(&d->event_lock));
@@ -702,22 +700,19 @@ void msixtbl_pt_unregister(struct domain *d, struct pirq
*pirq)
return;
msi_desc = irqd->msi_desc;
- if ( !msi_desc )
- goto out;
-
- pdev = msi_desc->dev;
-
- list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
- if ( pdev == entry->pdev )
- goto found;
-
-out:
- spin_unlock_irq(&irqd->lock);
- return;
+ if ( msi_desc )
+ {
+ const struct pci_dev *pdev = msi_desc->dev;
+ struct msixtbl_entry *entry;
-found:
- if ( atomic_dec_and_test(&entry->refcnt) )
- del_msixtbl_entry(entry);
+ list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
+ if ( pdev == entry->pdev )
+ {
+ if ( atomic_dec_and_test(&entry->refcnt) )
+ del_msixtbl_entry(entry);
+ break;
+ }
+ }
spin_unlock_irq(&irqd->lock);
}
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |