[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hw/pci/pci: Fix slot check for plugged devices
From: |
Julia Suvorova |
Subject: |
[PATCH] hw/pci/pci: Fix slot check for plugged devices |
Date: |
Wed, 23 Sep 2020 11:26:36 +0200 |
If devfn is assigned automatically, 'else' clauses will never be
executed. And if it does not matter for the reserved and available
devfn, because we have already checked it, the check for function0
needs to be done again.
Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
hw/pci/pci.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index de0fae10ab..ae132b0b52 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1034,8 +1034,9 @@ static PCIDevice *do_pci_register_device(PCIDevice
*pci_dev,
PCI_SLOT(devfn), PCI_FUNC(devfn), name,
bus->devices[devfn]->name);
return NULL;
- } else if (dev->hotplugged &&
- pci_get_function_0(pci_dev)) {
+ };
+
+ if (dev->hotplugged && pci_get_function_0(pci_dev)) {
error_setg(errp, "PCI: slot %d function 0 already ocuppied by %s,"
" new func %s cannot be exposed to guest.",
PCI_SLOT(pci_get_function_0(pci_dev)->devfn),
--
2.25.4
- [PATCH] hw/pci/pci: Fix slot check for plugged devices,
Julia Suvorova <=