From patchwork Tue Oct 30 05:18:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10660465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60FDA13A4 for ; Tue, 30 Oct 2018 05:20:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 505C829A86 for ; Tue, 30 Oct 2018 05:20:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44B0B29AAF; Tue, 30 Oct 2018 05:20:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC05129A86 for ; Tue, 30 Oct 2018 05:20:48 +0000 (UTC) Received: from localhost ([::1]:50836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHMSO-00078z-6k for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 Oct 2018 01:20:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHMQj-0005m6-1T for qemu-devel@nongnu.org; Tue, 30 Oct 2018 01:19:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHMQi-0005VU-Gi for qemu-devel@nongnu.org; Tue, 30 Oct 2018 01:19:05 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:34595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHMQg-0005UL-Pa; Tue, 30 Oct 2018 01:19:02 -0400 Received: by mail-pg1-x542.google.com with SMTP id k1-v6so3613895pgq.1; Mon, 29 Oct 2018 22:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dDSmHb1A+FJOTrF4tNqJjuWnld7W94TYD1FzcZrObgY=; b=OrBNQH3g7HhWNyB8M1vKx7N3Z8SApBp8mls7tfuyHrnBFa97FxWmVByqaP057dEOO2 K6p8Yc9zy7mqFnhVh0l55SYao03fHCUjUNLbO3l4LZ9vyEbiKZuIUnjWj/A02wA+Qoil XmnHmb6Y0U60Xgf9cNeT0RLqBGav41O6cl9duPosKHRieDVFzS5QNKbR7T4B0xVuOJUN /33/Zh+wG4jBFqWpv2Tb8czGa5siqjb5KQtZmiNdiannL9+FlR7WjVh2NvkY8A2p0eNU hIhguVvnQR/SjhCFJNoiY8ZMeLtbdKLNq/+WdvqlncKgnSv8wdaUFb7geP8u1M+T+QOd S2zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dDSmHb1A+FJOTrF4tNqJjuWnld7W94TYD1FzcZrObgY=; b=sNCDSWkCu+0qXIlr4GKX97deHbnz+NpGdQBb3xoNPuZqZx+dSqUAYU6ovPgQ4QKXgM HLDv6qO5Wqvm+9wYDShHwedG1VJXAf3lv4da5c8EF6kWDV45yByMIgNuF7FVoSe5KvbB w9sj+FzfA/iAs4b5AUJ5KGbwo3R1fbUTxC0bzQWceAEbBTWpD3SbQX0LjJzvaDGZ6R2X w1JQn/tE0X5+BwqPfKfDDR51dLdC6DxpVxFWJqJGvRhCmKSFSPUpACvoi0sJbI7/e0He +hqAKWlGU2TcTrC5M3jxLbbljN0WmuHoxm4osls+e35QNNI+C0dGbMslD0GDFm4NwQeX FZzg== X-Gm-Message-State: AGRZ1gJ/qTLM2R802niM7m4PZM35hq89JTwxtYGxTAO5na5i8KGHenEp GzgVXocUhMR4k8VceWEvoUs= X-Google-Smtp-Source: AJdET5d5kgkjbCW4mpdAeDkOIc+kiCLkM1PyFrJWZRCtmGPWzHJqowR5nDOyp6GhtgKWMubCFd298A== X-Received: by 2002:a62:7982:: with SMTP id u124-v6mr1418273pfc.95.1540876741952; Mon, 29 Oct 2018 22:19:01 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.65]) by smtp.gmail.com with ESMTPSA id p129-v6sm11463729pgp.92.2018.10.29.22.18.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 22:19:01 -0700 (PDT) From: Li Qiang To: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com Date: Mon, 29 Oct 2018 22:18:39 -0700 Message-Id: <1540876720-9574-4-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1540876720-9574-1-git-send-email-liq3ea@gmail.com> References: <1540876720-9574-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH 3/4] nvme: check msix_init_exclusive_bar return value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP As this function can fail. Signed-off-by: Li Qiang --- hw/block/nvme.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 72c9644..a406c23 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1250,7 +1250,10 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) pci_register_bar(&n->parent_obj, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); - msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4, NULL); + if (msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4, NULL)) { + error_setg(errp, "msix_init_exclusive_bar failed"); + return; + } id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID));