Message ID | 20221101135749.4477-13-akihiko.odaki@daynix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+qemu-devel=archiver.kernel.org+qemu-devel=archiver.kernel.org@nongnu.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36AE0C433FE for <qemu-devel@archiver.kernel.org>; Tue, 1 Nov 2022 16:58:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1oprnO-00063f-Mc; Tue, 01 Nov 2022 09:59:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <akihiko.odaki@daynix.com>) id 1oprnG-00062B-Kp for qemu-devel@nongnu.org; Tue, 01 Nov 2022 09:59:07 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <akihiko.odaki@daynix.com>) id 1oprnE-0004bj-6z for qemu-devel@nongnu.org; Tue, 01 Nov 2022 09:59:06 -0400 Received: by mail-pf1-x42a.google.com with SMTP id y13so13526701pfp.7 for <qemu-devel@nongnu.org>; Tue, 01 Nov 2022 06:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ve64Yknp9Z5jtrd7y/2CScvNeMugfa6S0tD/94xCa3A=; b=seVPVcjYWgwOnMdmIA3FozE2Cy9a5IiAswJIotzm9SgdcDDuKSJILYkHIozLPE6YOr mASdg9Zsy7LE+a5AdG2zzfppBAt2Q93pzEnZMLd1M8OHh4GlU2IMJLSzIueM9SeGQ3WB MI/B0u9Eh+Ckug6MikIq6LjmoRJOQesBmrsmDE48fkd9vx3RqJsU3kmhWUoRIIS3leJU 4n3g9GwMpKOZpR/63ggQJw7oJqUW9Yfb3sIuSO5ioE5atMRwNNUcrFXx+FlA3VIdehSh AHfGshtk8CzO1aNNJUrmeqv/e8YCF58EIbaMiPUy995V98WRqfdiH9yTYfbnEd1C8zQF RI+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ve64Yknp9Z5jtrd7y/2CScvNeMugfa6S0tD/94xCa3A=; b=kfm71n38Qq07bPOTPUOJDTRN6QoroAuGXimalcDW/c1NuGeesNlajwybmqHbwOxs2T tViK3GE7a0ArBTjtLqKjxnfd8O+1Vjcc2w4xtsv8n2SQdZ0PK7TSDpp+FfLDWriK+78I 2Etnjl6ZbOLJDRC8LIJi9CrZ1sKBmU9yssMBrHJrPqk9PE4VTmHm2LeTjo5GEIvv8KNH tPXfRnKBok221Y7TMW95EyKlJid56gIIATmQGkvZ/odcLMHI63OENT5Mu2/EtnZvavmj Ft7Y7esriRIsMqRpoukLbhF9RuJ5whXVzGCPFAfm1Et7QygL04o9uIgUNIgYG3bPM8Fj l1hg== X-Gm-Message-State: ACrzQf1hRxaf0PZwwGU4KGWhE5YDLYEyHDzdj+sKM4v5RVpMW9TIh+2m pz2aFqCaviVBAVgnSfIboDelzejPW1f95xZJ X-Google-Smtp-Source: AMsMyM4XAEmAeUuBNwpGBsL90d0tnVA5i69jvYhrUpyv94tC4F23puz3bdIC3rLvvSAByd2NeayQfQ== X-Received: by 2002:a65:4508:0:b0:43c:e3c6:d1c2 with SMTP id n8-20020a654508000000b0043ce3c6d1c2mr17137387pgq.582.1667311142548; Tue, 01 Nov 2022 06:59:02 -0700 (PDT) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id y4-20020aa79ae4000000b0056bdc3f5b29sm6510722pfp.186.2022.11.01.06.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 06:59:02 -0700 (PDT) From: Akihiko Odaki <akihiko.odaki@daynix.com> To: 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>, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= <philmd@linaro.org>, Akihiko Odaki <akihiko.odaki@daynix.com> Subject: [PATCH v8 12/17] msix: Omit errp for pci_add_capability Date: Tue, 1 Nov 2022 22:57:44 +0900 Message-Id: <20221101135749.4477-13-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221101135749.4477-1-akihiko.odaki@daynix.com> References: <20221101135749.4477-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2607:f8b0:4864:20::42a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Sender: "Qemu-devel" <qemu-devel-bounces@nongnu.org> Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org+qemu-devel=archiver.kernel.org@nongnu.org |
Series |
pci: Abort if pci_add_capability fails
|
expand
|
diff --git a/hw/pci/msix.c b/hw/pci/msix.c index 1e381a9813..28af83403b 100644 --- a/hw/pci/msix.c +++ b/hw/pci/msix.c @@ -311,7 +311,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries, uint8_t pba_bar_nr, unsigned pba_offset, uint8_t cap_pos, Error **errp) { - int cap; + uint8_t cap; unsigned table_size, pba_size; uint8_t *config; @@ -340,11 +340,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries, return -EINVAL; } - cap = pci_add_capability(dev, PCI_CAP_ID_MSIX, - cap_pos, MSIX_CAP_LENGTH, errp); - if (cap < 0) { - return cap; - } + cap = pci_add_capability(dev, PCI_CAP_ID_MSIX, cap_pos, MSIX_CAP_LENGTH); dev->msix_cap = cap; dev->cap_present |= QEMU_PCI_CAP_MSIX;
Omitting errp for pci_add_capability() causes it to abort if capabilities overlap. A caller of msix_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/msix.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)