From nobody Mon Feb 9 12:15:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1767856499; cv=none; d=zohomail.com; s=zohoarc; b=jjnolKzlcd9D7fmTqCVjnfHsvyA1I7sm9XBzi6LfjIytLgQvMuozlxK3Ko1xwh4wtg27wqCJDBJOL1gLSEoXk3FpmnjFTalZRIDRlgSiwwLxs280DgD/JoLZU1tyDIvOGof24xv/FwM/gMgBoPlo8knbzkUc9FBur6pD5Fzh3Dc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767856499; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Y4a0cYuav1Vio+9dWkD0CtDvJQ580nj+0sRoB4k30nI=; b=JZdCp68r9ndbz5JDp9wGoZwjPZm98Fxu7VBahqYbkzHKDE85wLtrtuMnktkpgWkx6SYn/RMfr88K8e9oBfl0anl7vNbbEELFOAJ+XdS6KkauXY13sPzfUM9BSU1bCUOX2uTmk1n9q3tGJxD59cxqdxTiJf2cpl3fY1o629bb56U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1767856499968680.3523817575879; Wed, 7 Jan 2026 23:14:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vdk6T-0006pH-S1; Thu, 08 Jan 2026 02:06:41 -0500 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 ) id 1vdk6O-0006jk-MV for qemu-devel@nongnu.org; Thu, 08 Jan 2026 02:06:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vdk6M-0006bF-Mz for qemu-devel@nongnu.org; Thu, 08 Jan 2026 02:06:36 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-MDFkAb8xO22CTG87E0UIKw-1; Thu, 08 Jan 2026 02:06:30 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2E01419560B2; Thu, 8 Jan 2026 07:06:29 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.45.242.32]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5E89130002D1; Thu, 8 Jan 2026 07:06:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id ED37821E61A8; Thu, 08 Jan 2026 08:06:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767855993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y4a0cYuav1Vio+9dWkD0CtDvJQ580nj+0sRoB4k30nI=; b=AQUB2ZyHc5Xuzhg3hLfNvCo2Q6ZpkOgpyWD8vxxZiBV6glrvC0OgCiBHYtwOCuB02gRYBb tbbVE+vqxxpDcBudq7M86pE0F4PAE7mH2/npRcfbVLh+Nho9t6j7KR+qHFEts3FXL47+xY /lOP2Nw+TZ2XykcuvucguEGMtSVZiag= X-MC-Unique: MDFkAb8xO22CTG87E0UIKw-1 X-Mimecast-MFC-AGG-ID: MDFkAb8xO22CTG87E0UIKw_1767855989 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Vladimir Sementsov-Ogievskiy , Peter Xu , Luc Michel , Zhao Liu Subject: [PULL v2 02/17] hw/nvram/xlnx-bbram: More idiomatic and simpler error reporting Date: Thu, 8 Jan 2026 08:06:10 +0100 Message-ID: <20260108070625.1586474-3-armbru@redhat.com> In-Reply-To: <20260108070625.1586474-1-armbru@redhat.com> References: <20260108070625.1586474-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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 (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=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1767856502251158500 Content-Type: text/plain; charset="utf-8" bbram_bdrv_error() interpolates a "detail" string into a template with error_setg_errno(), then reports the result with error_report(). Produces error messages with an unwanted '.': BLK-NAME: BBRAM backstore DETAIL failed.: STERROR Replace both calls of bbram_bdrv_error() by straightforward error_report(), and drop the function. This is less code, easier to read, and the error message is more greppable. Also delete the unwanted '.'. Signed-off-by: Markus Armbruster Message-ID: <20251119130855.105479-3-armbru@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Peter Xu Reviewed-by: Luc Michel Reviewed-by: Zhao Liu --- hw/nvram/xlnx-bbram.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/hw/nvram/xlnx-bbram.c b/hw/nvram/xlnx-bbram.c index 60ede7e40f..edfb592a5e 100644 --- a/hw/nvram/xlnx-bbram.c +++ b/hw/nvram/xlnx-bbram.c @@ -88,18 +88,6 @@ static bool bbram_pgm_enabled(XlnxBBRam *s) return ARRAY_FIELD_EX32(s->regs, BBRAM_STATUS, PGM_MODE) !=3D 0; } =20 -static void bbram_bdrv_error(XlnxBBRam *s, int rc, gchar *detail) -{ - Error *errp =3D NULL; - - error_setg_errno(&errp, -rc, "%s: BBRAM backstore %s failed.", - blk_name(s->blk), detail); - error_report("%s", error_get_pretty(errp)); - error_free(errp); - - g_free(detail); -} - static void bbram_bdrv_read(XlnxBBRam *s, Error **errp) { uint32_t *ram =3D &s->regs[R_BBRAM_0]; @@ -162,7 +150,8 @@ static void bbram_bdrv_sync(XlnxBBRam *s, uint64_t hwad= dr) offset =3D hwaddr - A_BBRAM_0; rc =3D blk_pwrite(s->blk, offset, 4, &le32, 0); if (rc < 0) { - bbram_bdrv_error(s, rc, g_strdup_printf("write to offset %u", offs= et)); + error_report("%s: BBRAM backstore write to offset %u failed: %s", + blk_name(s->blk), offset, strerror(-rc)); } } =20 @@ -178,7 +167,8 @@ static void bbram_bdrv_zero(XlnxBBRam *s) =20 rc =3D blk_make_zero(s->blk, 0); if (rc < 0) { - bbram_bdrv_error(s, rc, g_strdup("zeroizing")); + error_report("%s: BBRAM backstore zeroizing failed: %s", + blk_name(s->blk), strerror(-rc)); } =20 /* Restore bbram8 if it is non-zero */ --=20 2.52.0