From nobody Fri Dec 19 17:51:27 2025 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=1593018924; cv=none; d=zohomail.com; s=zohoarc; b=CrkoZ7uVT6zVMq3LLSZV8YFRTum3xF2FFbOOAYIS0X/BCi7jkMnSr9987/gy8eKEpMQL7Uzm4lwvbXjQF4+jVqATTcdGKczl0Nxb/BLeHBGygpQpDUfDs6QhoXhqrYCpMjGeYZCZ9zu/J5yzqTIyT509AbozjYX/EUvlvBNHOLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593018924; 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=rTBm/kLekBBTAbmGDO3gnSmTOXa5KE/0qiE6PbFMHgA=; b=DBc0FU6sVGqxGQ7Neke1qlY9J34bj4UD50MsBckQhoQCuyx9ywagNAdcPZywrW32cUEQWJ4jYrkSlLF75OPfHb1Bmu1NEgA59LzTSNDOVraG3h7N+myUDgNUCjJib+u3hulbjlOVEY70r3dx7zbptJAeKX0dr5LYXBCtXa69Ess= 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 1593018924013331.26770005193214; Wed, 24 Jun 2020 10:15:24 -0700 (PDT) Received: from localhost ([::1]:46434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jo8za-0007ac-Lz for importer@patchew.org; Wed, 24 Jun 2020 13:15:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jo8Vm-0004X8-L7 for qemu-devel@nongnu.org; Wed, 24 Jun 2020 12:44:34 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:21579 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jo8VD-00059y-Rb for qemu-devel@nongnu.org; Wed, 24 Jun 2020 12:44:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-271-9izfTIkgMma_kdkbv5BDkg-1; Wed, 24 Jun 2020 12:43:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89C7E2D59; Wed, 24 Jun 2020 16:43:50 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30F1660F8A; Wed, 24 Jun 2020 16:43:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 283B31138480; Wed, 24 Jun 2020 18:43:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593017038; 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=rTBm/kLekBBTAbmGDO3gnSmTOXa5KE/0qiE6PbFMHgA=; b=MGT6IZMD0/dRtkcdvBopiqS/d5m0K2jG+nAiAnfl5rcJV78ehbTK2/wEya3jCN2LvQ5uPD Occd/ZllRtrGHyaXgzELjqZw0nuRTJBH6yLbeE+370Vs2MAVmITJVrhLQ6rmEYXFbyE6XF qNSHfYJsTDNalepqdkxBfN1eQV86VHA= X-MC-Unique: 9izfTIkgMma_kdkbv5BDkg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 19/46] block: Avoid unnecessary error_propagate() after error_setg() Date: Wed, 24 Jun 2020 18:43:17 +0200 Message-Id: <20200624164344.3778251-20-armbru@redhat.com> In-Reply-To: <20200624164344.3778251-1-armbru@redhat.com> References: <20200624164344.3778251-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 01:59:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: peter.maydell@linaro.org, vsementsov@virtuozzo.com, berrange@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The previous commit enables another round of the transformation from recent commit "error: Avoid unnecessary error_propagate() after error_setg()". Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- block/quorum.c | 16 +++++++--------- block/replication.c | 12 +++++------- block/vxhs.c | 10 ++++------ 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 9ed20e1998..6df9449fc2 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -910,13 +910,12 @@ static int quorum_open(BlockDriverState *bs, QDict *o= ptions, int flags, /* count how many different children are present */ s->num_children =3D qdict_array_entries(options, "children."); if (s->num_children < 0) { - error_setg(&local_err, "Option children is not a valid array"); + error_setg(errp, "Option children is not a valid array"); ret =3D -EINVAL; goto exit; } if (s->num_children < 1) { - error_setg(&local_err, - "Number of provided children must be 1 or more"); + error_setg(errp, "Number of provided children must be 1 or more"); ret =3D -EINVAL; goto exit; } @@ -929,7 +928,7 @@ static int quorum_open(BlockDriverState *bs, QDict *opt= ions, int flags, =20 s->threshold =3D qemu_opt_get_number(opts, QUORUM_OPT_VOTE_THRESHOLD, = 0); /* and validate it against s->num_children */ - ret =3D quorum_valid_threshold(s->threshold, s->num_children, &local_e= rr); + ret =3D quorum_valid_threshold(s->threshold, s->num_children, errp); if (ret < 0) { goto exit; } @@ -942,7 +941,7 @@ static int quorum_open(BlockDriverState *bs, QDict *opt= ions, int flags, -EINVAL, NULL); } if (ret < 0) { - error_setg(&local_err, "Please set read-pattern as fifo or quorum"= ); + error_setg(errp, "Please set read-pattern as fifo or quorum"); goto exit; } s->read_pattern =3D ret; @@ -950,7 +949,7 @@ static int quorum_open(BlockDriverState *bs, QDict *opt= ions, int flags, if (s->read_pattern =3D=3D QUORUM_READ_PATTERN_QUORUM) { s->is_blkverify =3D qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, = false); if (s->is_blkverify && (s->num_children !=3D 2 || s->threshold != =3D 2)) { - error_setg(&local_err, "blkverify=3Don can only be set if ther= e are " + error_setg(errp, "blkverify=3Don can only be set if there are " "exactly two files and vote-threshold is 2"); ret =3D -EINVAL; goto exit; @@ -959,7 +958,7 @@ static int quorum_open(BlockDriverState *bs, QDict *opt= ions, int flags, s->rewrite_corrupted =3D qemu_opt_get_bool(opts, QUORUM_OPT_REWRIT= E, false); if (s->rewrite_corrupted && s->is_blkverify) { - error_setg(&local_err, + error_setg(errp, "rewrite-corrupted=3Don cannot be used with blkveri= fy=3Don"); ret =3D -EINVAL; goto exit; @@ -979,6 +978,7 @@ static int quorum_open(BlockDriverState *bs, QDict *opt= ions, int flags, &child_of_bds, BDRV_CHILD_DATA, f= alse, &local_err); if (local_err) { + error_propagate(errp, local_err); ret =3D -EINVAL; goto close_exit; } @@ -1004,8 +1004,6 @@ close_exit: g_free(opened); exit: qemu_opts_del(opts); - /* propagate error */ - error_propagate(errp, local_err); return ret; } =20 diff --git a/block/replication.c b/block/replication.c index 7f4ab357a4..0c70215784 100644 --- a/block/replication.c +++ b/block/replication.c @@ -85,7 +85,6 @@ static int replication_open(BlockDriverState *bs, QDict *= options, { int ret; BDRVReplicationState *s =3D bs->opaque; - Error *local_err =3D NULL; QemuOpts *opts =3D NULL; const char *mode; const char *top_id; @@ -105,7 +104,7 @@ static int replication_open(BlockDriverState *bs, QDict= *options, =20 mode =3D qemu_opt_get(opts, REPLICATION_MODE); if (!mode) { - error_setg(&local_err, "Missing the option mode"); + error_setg(errp, "Missing the option mode"); goto fail; } =20 @@ -113,7 +112,8 @@ static int replication_open(BlockDriverState *bs, QDict= *options, s->mode =3D REPLICATION_MODE_PRIMARY; top_id =3D qemu_opt_get(opts, REPLICATION_TOP_ID); if (top_id) { - error_setg(&local_err, "The primary side does not support opti= on top-id"); + error_setg(errp, + "The primary side does not support option top-id"); goto fail; } } else if (!strcmp(mode, "secondary")) { @@ -121,11 +121,11 @@ static int replication_open(BlockDriverState *bs, QDi= ct *options, top_id =3D qemu_opt_get(opts, REPLICATION_TOP_ID); s->top_id =3D g_strdup(top_id); if (!s->top_id) { - error_setg(&local_err, "Missing the option top-id"); + error_setg(errp, "Missing the option top-id"); goto fail; } } else { - error_setg(&local_err, + error_setg(errp, "The option mode's value should be primary or secondary= "); goto fail; } @@ -136,8 +136,6 @@ static int replication_open(BlockDriverState *bs, QDict= *options, =20 fail: qemu_opts_del(opts); - error_propagate(errp, local_err); - return ret; } =20 diff --git a/block/vxhs.c b/block/vxhs.c index 20513a43f4..ef2848fb60 100644 --- a/block/vxhs.c +++ b/block/vxhs.c @@ -300,7 +300,6 @@ static int vxhs_open(BlockDriverState *bs, QDict *optio= ns, QemuOpts *opts =3D NULL; QemuOpts *tcp_opts =3D NULL; char *of_vsa_addr =3D NULL; - Error *local_err =3D NULL; const char *vdisk_id_opt; const char *server_host_opt; int ret =3D 0; @@ -326,14 +325,14 @@ static int vxhs_open(BlockDriverState *bs, QDict *opt= ions, /* vdisk-id is the disk UUID */ vdisk_id_opt =3D qemu_opt_get(opts, VXHS_OPT_VDISK_ID); if (!vdisk_id_opt) { - error_setg(&local_err, QERR_MISSING_PARAMETER, VXHS_OPT_VDISK_ID); + error_setg(errp, QERR_MISSING_PARAMETER, VXHS_OPT_VDISK_ID); ret =3D -EINVAL; goto out; } =20 /* vdisk-id may contain a leading '/' */ if (strlen(vdisk_id_opt) > UUID_FMT_LEN + 1) { - error_setg(&local_err, "vdisk-id cannot be more than %d characters= ", + error_setg(errp, "vdisk-id cannot be more than %d characters", UUID_FMT_LEN); ret =3D -EINVAL; goto out; @@ -352,14 +351,14 @@ static int vxhs_open(BlockDriverState *bs, QDict *opt= ions, =20 server_host_opt =3D qemu_opt_get(tcp_opts, VXHS_OPT_HOST); if (!server_host_opt) { - error_setg(&local_err, QERR_MISSING_PARAMETER, + error_setg(errp, QERR_MISSING_PARAMETER, VXHS_OPT_SERVER"."VXHS_OPT_HOST); ret =3D -EINVAL; goto out; } =20 if (strlen(server_host_opt) > MAXHOSTNAMELEN) { - error_setg(&local_err, "server.host cannot be more than %d charact= ers", + error_setg(errp, "server.host cannot be more than %d characters", MAXHOSTNAMELEN); ret =3D -EINVAL; goto out; @@ -412,7 +411,6 @@ out: =20 if (ret < 0) { vxhs_unref(); - error_propagate(errp, local_err); g_free(s->vdisk_hostinfo.host); g_free(s->vdisk_guid); g_free(s->tlscredsid); --=20 2.26.2