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 04/17] ahci: Omit errp for pci_add_capability
Date: Tue,  1 Nov 2022 23:55:45 +0900	[thread overview]
Message-ID: <20221101145558.3998-5-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. This behavior is appropriate here because all of
the capabilities set in this device are defined in the program and
their overlap should not happen unless there is a programming error.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 hw/ide/ich.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 1007a51fcb..3b478b01f8 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -106,7 +106,7 @@ static void pci_ich9_ahci_init(Object *obj)
 static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
 {
     struct AHCIPCIState *d;
-    int sata_cap_offset;
+    uint8_t sata_cap_offset;
     uint8_t *sata_cap;
     d = ICH9_AHCI(dev);
     int ret;
@@ -130,11 +130,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
                      &d->ahci.mem);
 
     sata_cap_offset = pci_add_capability(dev, PCI_CAP_ID_SATA,
-                                          ICH9_SATA_CAP_OFFSET, SATA_CAP_SIZE,
-                                          errp);
-    if (sata_cap_offset < 0) {
-        return;
-    }
+                                          ICH9_SATA_CAP_OFFSET, SATA_CAP_SIZE);
 
     sata_cap = dev->config + sata_cap_offset;
     pci_set_word(sata_cap + SATA_CAP_REV, 0x10);
-- 
2.38.1



  parent reply	other threads:[~2022-11-01 17:11 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 ` Akihiko Odaki [this message]
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 ` [PATCH v9 08/17] msi: " Akihiko Odaki
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-5-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.