All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	qemu-arm@nongnu.org, "Michael S . Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"John Snow" <jsnow@redhat.com>,
	"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Stefan Weil" <sw@weilnetz.de>, "Keith Busch" <kbusch@kernel.org>,
	"Klaus Jensen" <its@irrelevant.dk>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Andrey Smirnov" <andrew.smirnov@gmail.com>,
	"Paul Burton" <paulburton@kernel.org>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Yan Vugenfirer" <yan@daynix.com>,
	"Yuri Benditovich" <yuri.benditovich@daynix.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Akihiko Odaki" <akihiko.odaki@daynix.com>
Subject: [PATCH v9 08/17] msi: Omit errp for pci_add_capability
Date: Tue,  1 Nov 2022 23:55:49 +0900	[thread overview]
Message-ID: <20221101145558.3998-9-akihiko.odaki@daynix.com> (raw)
In-Reply-To: <20221101145558.3998-1-akihiko.odaki@daynix.com>

Omitting errp for pci_add_capability() causes it to abort if
capabilities overlap. A caller of msi_init(), which calls
pci_add_capability() in turn, is expected to ensure that will not
happen.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 hw/pci/msi.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index 058d1d1ef1..5283a08b5a 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -194,7 +194,6 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
     unsigned int vectors_order;
     uint16_t flags;
     uint8_t cap_size;
-    int config_offset;
 
     if (!msi_nonbroken) {
         error_setg(errp, "MSI is not supported by interrupt controller");
@@ -221,13 +220,7 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
     }
 
     cap_size = msi_cap_sizeof(flags);
-    config_offset = pci_add_capability(dev, PCI_CAP_ID_MSI, offset,
-                                        cap_size, errp);
-    if (config_offset < 0) {
-        return config_offset;
-    }
-
-    dev->msi_cap = config_offset;
+    dev->msi_cap = pci_add_capability(dev, PCI_CAP_ID_MSI, offset, cap_size);
     dev->cap_present |= QEMU_PCI_CAP_MSI;
 
     pci_set_word(dev->config + msi_flags_off(dev), flags);
-- 
2.38.1



  parent reply	other threads:[~2022-11-01 17:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 14:55 [PATCH v9 00/17] pci: Abort if pci_add_capability fails Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 01/17] hw/vfio/pci: Ensure MSI and MSI-X do not overlap Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 02/17] pci: Allow to omit errp for pci_add_capability Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 03/17] hw/i386/amd_iommu: Omit " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 04/17] ahci: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 05/17] e1000e: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 06/17] eepro100: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 07/17] hw/nvme: " Akihiko Odaki
2022-11-01 14:55 ` Akihiko Odaki [this message]
2022-11-01 14:55 ` [PATCH v9 09/17] hw/pci/pci_bridge: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 10/17] pcie: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 11/17] pci/shpc: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 12/17] msix: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 13/17] pci/slotid: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 14/17] hw/pci-bridge/pcie_pci_bridge: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 15/17] hw/vfio/pci: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 16/17] virtio-pci: " Akihiko Odaki
2022-11-01 14:55 ` [PATCH v9 17/17] pci: Remove legacy errp from pci_add_capability Akihiko Odaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221101145558.3998-9-akihiko.odaki@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=dmitry.fleytman@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=its@irrelevant.dk \
    --cc=jasowang@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=kraxel@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=paulburton@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sw@weilnetz.de \
    --cc=yan@daynix.com \
    --cc=yuri.benditovich@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.