From nobody Mon Feb 9 07:56:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1603964049; cv=none; d=zohomail.com; s=zohoarc; b=Bi0e+S16JiK8UGqgvbrRgapx4HJ43QDvFR1HiyHkr+XE3RLla8KNcQT06RpZj6mVCdN0trRXpeQniREkmniP5ZUQvsmaUSY/8VpbVVAjwA6bGGGZ2C08GUTo3rLwetgwKwioMbaqbha6+H+jtU707C+20NniPBnfeOgwx/vEj4s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964049; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=C+MwM4zuNe+rNYGXGpfeK41VSib34xtRzDIP8WoYZOs=; b=XarmvSX0mPOHtAQcnlu3U9vP3Vdj53DPStiwspJbbpf/Bu4Gn/x51lzS6i3uEnbA3aLWhpsjUl1RtygDjGWhMJVl8r3JFiE366bN4VumYyZtr0JwNecYjJkLry8mz9iA1BF5k7uhZFNjCruIFdzayMvpQ0LyqoFtMG4F0Qv0zqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964049365476.57380442311273; Thu, 29 Oct 2020 02:34:09 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-41-fVGFlS2VNamqlQN4rj19RQ-1; Thu, 29 Oct 2020 05:34:04 -0400 Received: by mail-ej1-f69.google.com with SMTP id f11so918159eja.23 for ; Thu, 29 Oct 2020 02:34:04 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id k26sm1166658edf.85.2020.10.29.02.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964048; 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=C+MwM4zuNe+rNYGXGpfeK41VSib34xtRzDIP8WoYZOs=; b=T0LxP+Hub2oDOqnuMNCLj/y3U5tGd+VHmOwPLw3pA/isG8JMMX397FfqWqrFL/95xzDidZ tKNM1wyw3GUU0DrCe411YclmD28dOu61w+1qEreBIwe62PKQgw4etzHrtrCY+9BJHmGQCB M4E4IxRprO7W/jtWclu5qDi8iB7v/V8= X-MC-Unique: fVGFlS2VNamqlQN4rj19RQ-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=C+MwM4zuNe+rNYGXGpfeK41VSib34xtRzDIP8WoYZOs=; b=INDnXYrHrk2pxVmS4HAj4ULl9dn5o1Hhs7hj25/LnO1llx6bfqGcipTdjMU8KP4uJU 1+8sGJx4iUnPOadLIUD0R81ZgkV/d5QisOMHbD711FyCtZiOm5pR+eFvJJwouMa2aVKD MDIX8QKK/PsSK8U4XKkZWxpeIo0xmFLyp15vlcFS6eP40a6kDoBS1KZYmayCC53r5jPo m2LmP3of10OVHNB5VmfPx48JKyEEbJuGac38L9V+B7NHWGnkSf9brDkphO1S5F8aOkHr cuUBbOe/jyBX/D+Jj5JE9a0ySpzYWHtFuLmLi0EkXxWvbop3t8wELPxnTOQ+PBYXAeF3 MxQw== X-Gm-Message-State: AOAM531fauxSOndRh0O2DuZ0xQ6vQGYYZx0jNXVodtYsZVrW7wVdIFUB zcqgSOJr2PDvIAAayvKCu7hYiGJ0mwrFBQK+UXRKfqrIkOgxliQJADRDCO6G401t9jGKHB3TXij XR3LfHnpUnAedIg== X-Received: by 2002:a50:8125:: with SMTP id 34mr3152139edc.39.1603964043060; Thu, 29 Oct 2020 02:34:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF4kkM/D9J7bCjTQpyvr3ZD4e+DAev94YnVBvQHSdQCIOAaI9hOoQR1Cw/w4IUExJsIfzPKQ== X-Received: by 2002:a50:8125:: with SMTP id 34mr3152120edc.39.1603964042834; Thu, 29 Oct 2020 02:34:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 10/25] block/nvme: Make nvme_identify() return boolean indicating error Date: Thu, 29 Oct 2020 10:32:51 +0100 Message-Id: <20201029093306.1063879-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Just for consistency, following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), return a boolean value indicating an error is set or not. Directly pass errp as the local_err is not requested in our case. Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index c450499111e..98335012457 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -506,9 +506,11 @@ static int nvme_cmd_sync(BlockDriverState *bs, NVMeQue= uePair *q, return ret; } =20 -static void nvme_identify(BlockDriverState *bs, int namespace, Error **err= p) +/* Returns true on success, false on failure. */ +static bool nvme_identify(BlockDriverState *bs, int namespace, Error **err= p) { BDRVNVMeState *s =3D bs->opaque; + bool ret =3D false; union { NvmeIdCtrl ctrl; NvmeIdNs ns; @@ -585,10 +587,13 @@ static void nvme_identify(BlockDriverState *bs, int n= amespace, Error **errp) goto out; } =20 + ret =3D true; s->blkshift =3D lbaf->ds; out: qemu_vfio_dma_unmap(s->vfio, id); qemu_vfree(id); + + return ret; } =20 static bool nvme_poll_queue(NVMeQueuePair *q) @@ -701,7 +706,6 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, uint64_t cap; uint64_t timeout_ms; uint64_t deadline, now; - Error *local_err =3D NULL; volatile NvmeBar *regs =3D NULL; =20 qemu_co_mutex_init(&s->dma_map_lock); @@ -818,9 +822,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, &s->irq_notifier[MSIX_SHARED_IRQ_IDX], false, nvme_handle_event, nvme_poll_cb); =20 - nvme_identify(bs, namespace, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!nvme_identify(bs, namespace, errp)) { ret =3D -EIO; goto out; } --=20 2.26.2