From nobody Wed Feb 11 01:09:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529946250846864.2552738582054; Mon, 25 Jun 2018 10:04:10 -0700 (PDT) Received: from localhost ([::1]:48363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXUuQ-0003zM-4e for importer@patchew.org; Mon, 25 Jun 2018 13:04:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXUob-00009Z-AN for qemu-devel@nongnu.org; Mon, 25 Jun 2018 12:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXUoa-000723-AG for qemu-devel@nongnu.org; Mon, 25 Jun 2018 12:58:09 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:34688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXUoa-00071m-3v for qemu-devel@nongnu.org; Mon, 25 Jun 2018 12:58:08 -0400 Received: by mail-qt0-x241.google.com with SMTP id b20-v6so3341498qtp.1 for ; Mon, 25 Jun 2018 09:58:07 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id k129-v6sm9856727qkd.13.2018.06.25.09.58.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 09:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KuY8HupqKJhhbgS5c5q7gDc9jy9464PkYAHeB2x018s=; b=PLDslfvtms6SQ7xb5zliJht4m898IZH80M4rWtKXq+c8w0QAH88+D5tMVm6kS+4L0s d+vzR+bDeoEMI9lMKae1gHk3nVS76a92y9FRL9GO9BBCcBFHlg/kTNBBZGft6l7spZcr cOJ/BYkJapQPk21g0mZ45Rpcz1/n+0xz3cwQk4mVXiDrEeTvT7FuZmaV2LRAbbjHJccP L/dCHEN2/gHJRg6/y9hcqWykwTzExorefd3Z9TZvGEudxaj7ZqZH95ijjhB7kX70EPmB +aoVCE65acJKWnNuyJezT7V5JEyTcjpB1/AgS7OrPLJK8LqhPjmAqjobSYDpZDTQkSKG IurA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=KuY8HupqKJhhbgS5c5q7gDc9jy9464PkYAHeB2x018s=; b=HqsTcHPWnhVPzv5X04e/WxnecjW6mEDjWb8jE8H3EnVJGJ6kwgCWhfNl6oBcKWUkTX lhQfLTnbCJCZBX2SL1eGgs7nQrJvuu/h/ul13DzkfRska7I1AWSmlTwS+eVwvl/gTCgj 4Nk0Q9sGWTaBykoEWWx5z6ev14i4R3RBDyhMEUxSJDyvTqPEqUnVxT4PsE+UUY9YkHX7 gsTfUQ91+CO3GUwgp6eotQuF+YKo3rgFsQQFiF4CIjz2XO0OhjX08MgyFXwWi7DWRrVU +2SHh/L0uTD1JTqq8G7gUrOYNuqBLVruM8V71rGj7pqBJyf43sUd4vu9Lac9FLMhtI1R jxcg== X-Gm-Message-State: APt69E0gtBUD8VOi4NEdQxbAIJc4RhZSPIqAlJfuMWzX/4IgJRoW9wqA G7siW49/AJACZZ8sOwOeqQo= X-Google-Smtp-Source: ADUXVKIz5pvNQ1GEcJplrULmk83AQVlPV2MOPXyqE71DYlyk1bPjVTJAA/nRYH40JqcpDYu/NbsC5w== X-Received: by 2002:ac8:950:: with SMTP id z16-v6mr11713664qth.299.1529945887372; Mon, 25 Jun 2018 09:58:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Peter Maydell Date: Mon, 25 Jun 2018 13:57:49 -0300 Message-Id: <20180625165749.3910-4-f4bug@amsat.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180625165749.3910-1-f4bug@amsat.org> References: <20180625165749.3910-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH v4 3/3] device_tree: Replace error_setg(&error_fatal) by error_report() + exit() 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: Peter Crosthwaite , qemu-devel@nongnu.org, Markus Armbruster , Alexander Graf , =?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) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Use error_report() + exit() instead of error_setg(&error_fatal), as suggested by the "qapi/error.h" documentation: Please don't error_setg(&error_fatal, ...), use error_report() and exit(), because that's more obvious. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Auger Reviewed-by: Markus Armbruster Reviewed-by: David Gibson --- device_tree.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/device_tree.c b/device_tree.c index 52c3358a55..3553819257 100644 --- a/device_tree.c +++ b/device_tree.c @@ -140,15 +140,16 @@ static void read_fstree(void *fdt, const char *dirnam= e) const char *parent_node; =20 if (strstr(dirname, root_dir) !=3D dirname) { - error_setg(&error_fatal, "%s: %s must be searched within %s", - __func__, dirname, root_dir); + error_report("%s: %s must be searched within %s", + __func__, dirname, root_dir); + exit(1); } parent_node =3D &dirname[strlen(SYSFS_DT_BASEDIR)]; =20 d =3D opendir(dirname); if (!d) { - error_setg(&error_fatal, "%s cannot open %s", __func__, dirname); - return; + error_report("%s cannot open %s", __func__, dirname); + exit(1); } =20 while ((de =3D readdir(d)) !=3D NULL) { @@ -162,7 +163,8 @@ static void read_fstree(void *fdt, const char *dirname) tmpnam =3D g_strdup_printf("%s/%s", dirname, de->d_name); =20 if (lstat(tmpnam, &st) < 0) { - error_setg(&error_fatal, "%s cannot lstat %s", __func__, tmpna= m); + error_report("%s cannot lstat %s", __func__, tmpnam); + exit(1); } =20 if (S_ISREG(st.st_mode)) { @@ -170,8 +172,9 @@ static void read_fstree(void *fdt, const char *dirname) gsize len; =20 if (!g_file_get_contents(tmpnam, &val, &len, NULL)) { - error_setg(&error_fatal, "%s not able to extract info from= %s", - __func__, tmpnam); + error_report("%s not able to extract info from %s", + __func__, tmpnam); + exit(1); } =20 if (strlen(parent_node) > 0) { @@ -206,9 +209,9 @@ void *load_device_tree_from_sysfs(void) host_fdt =3D create_device_tree(&host_fdt_size); read_fstree(host_fdt, SYSFS_DT_BASEDIR); if (fdt_check_header(host_fdt)) { - error_setg(&error_fatal, - "%s host device tree extracted into memory is invalid", - __func__); + error_report("%s host device tree extracted into memory is invalid= ", + __func__); + exit(1); } return host_fdt; } --=20 2.18.0