From nobody Mon Feb 9 08:57:46 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597943086; cv=none; d=zohomail.com; s=zohoarc; b=JaPJ62UBgCsxALzlNKzsoQme0ORXAO6NrYdBb8qVHtt5pn7rtA+rm51xtTZrkmL50jlEOtcixQdbNAzA59+BkOw86NFMybJBGZw2+gg7WkySzJf+sr/G1w7X5b0VfyPNQUN2XQwzxl1GQjTVEaYKaEEABZNe6I/tzZmLFuK7bGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597943086; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QyQg0f8W8M9I/uKJA3ih2AcbkHq7TajNoPXSDgqGq4I=; b=KgipCJQsdbTzxuOAyQGck3ARzyfEIES5XyP+fw5e381KqnOYYzYZfDXyxdFD0EqsW4ff9cYZgTHJegZByvKOyNgmHh3qJsF7GeI0YJnGAiJ17P8fmAwgNiq37K8j5B4OoYkiOVIDEPcvT7wl/CEU3dA/a4hMXDSoy0bzFAgaZ4E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597943086719890.9381012610744; Thu, 20 Aug 2020 10:04:46 -0700 (PDT) Received: from localhost ([::1]:37960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8nzZ-00031F-DP for importer@patchew.org; Thu, 20 Aug 2020 13:04:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8nug-0003js-2G for qemu-devel@nongnu.org; Thu, 20 Aug 2020 12:59:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k8nud-0006Dc-88 for qemu-devel@nongnu.org; Thu, 20 Aug 2020 12:59:41 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-vha2TIT5P8eEXpSbskUbqw-1; Thu, 20 Aug 2020 12:59:36 -0400 Received: by mail-wm1-f70.google.com with SMTP id d22so1006094wmd.2 for ; Thu, 20 Aug 2020 09:59:36 -0700 (PDT) Received: from x1w.redhat.com (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id o125sm5413165wma.27.2020.08.20.09.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 09:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597942778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QyQg0f8W8M9I/uKJA3ih2AcbkHq7TajNoPXSDgqGq4I=; b=Il/zBo9ZrqRuyvdXYWFkYvSxrh18wI4SyXttKzt6AIUNGc2P/+qCjorU1A4i6qMX3NuetZ joUntxHIPK2HWNopPqyT7xGpl3znsx1Y4DDPS4Tm7DEl2S+nh64CXBqpR2Kbr9i+iTs2dZ tZD5M6CGeQikYaOBpZ67i4zBpN+ejQw= X-MC-Unique: vha2TIT5P8eEXpSbskUbqw-1 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:mime-version:content-transfer-encoding; bh=QyQg0f8W8M9I/uKJA3ih2AcbkHq7TajNoPXSDgqGq4I=; b=aPbfLyTNge1E8qJ7x0Gj6F2QUWEV6SXGoV7C/0kh7QaU2o0VLIUO+0uuIu1xIECmPH Wxb2NGyifxpRvzwnJQBvnIEknn/bhFK9dLIRBvIpSeMrbxkqm8TUeBn2gxr0uPdbqlmi rNEow7Rsb91kMN2wDj1h15utTE91n386K02JKvadNM0Mfzxh7d1eq74Msvu8IjYoeSGo w6rZR2qbkRhL4XgZTHhZD/S1O4G1cFhP5OI3AizSpgmg77WINlYps8F9hj9KWvoiUcvZ vp/99MzgmtPyYf/iyMYxnRxkzFaeUB+FBy9rhXQITyAo2lhQFFVzx34k3Ktq/pBrqB3y 7Y/Q== X-Gm-Message-State: AOAM532EUlNBvi0YBwP+jyLUogTae5ZCv0jyl4fwN+n0jwWGwsGBjUdM vr2oaB7jcTet4NYzTHzJD2+Fq0h3QEGd6O4eU44lnYVgADI1evvkNBT4m7msBkHTTfYkIM7QLXm diM90lRinGVqDvaw= X-Received: by 2002:adf:fac8:: with SMTP id a8mr4111289wrs.368.1597942775259; Thu, 20 Aug 2020 09:59:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydMsAUhYQbfhGtVA5j/dvyfPGyX+ZXJ2dmEgjyQE5ING4JH30IKSDnuP94sT2fxWnFq3Ngdg== X-Received: by 2002:adf:fac8:: with SMTP id a8mr4111278wrs.368.1597942775110; Thu, 20 Aug 2020 09:59:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 06/15] block/nvme: Use common error path in nvme_add_io_queue() Date: Thu, 20 Aug 2020 18:58:52 +0200 Message-Id: <20200820165901.1139109-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200820165901.1139109-1-philmd@redhat.com> References: <20200820165901.1139109-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 06:28:30 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Rearrange nvme_add_io_queue() by using a common error path. This will be proven useful in few commits where we add IRQ notification to the IO queues. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 53448b7d230..3101f1ad55d 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -649,8 +649,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Err= or **errp) }; if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { error_setg(errp, "Failed to create CQ io queue [%d]", n); - nvme_free_queue_pair(q); - return false; + goto out_error; } cmd =3D (NvmeCmd) { .opcode =3D NVME_ADM_CMD_CREATE_SQ, @@ -660,13 +659,15 @@ static bool nvme_add_io_queue(BlockDriverState *bs, E= rror **errp) }; if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { error_setg(errp, "Failed to create SQ io queue [%d]", n); - nvme_free_queue_pair(q); - return false; + goto out_error; } s->queues =3D g_renew(NVMeQueuePair *, s->queues, n + 1); s->queues[n] =3D q; s->nr_queues++; return true; +out_error: + nvme_free_queue_pair(q); + return false; } =20 static bool nvme_poll_cb(void *opaque) --=20 2.26.2