From nobody Mon Apr 29 06:55:38 2024 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 152838361561223.985431787082575; Thu, 7 Jun 2018 08:00:15 -0700 (PDT) Received: from localhost ([::1]:58438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwOZ-0002Dv-1G for importer@patchew.org; Thu, 07 Jun 2018 11:00:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwBu-0000oS-1W for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQwBt-0008C9-5r for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:06 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:33522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQwBt-0008Bp-0j; Thu, 07 Jun 2018 10:47:05 -0400 Received: by mail-qk0-x242.google.com with SMTP id h7-v6so6723408qkm.0; Thu, 07 Jun 2018 07:47:04 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id s128-v6sm11607363qkh.2.2018.06.07.07.46.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 07:47:03 -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=5uzXa8Nq8BEcI0ZuswhY5o9lBuNoRfH3yZmZoYECPKc=; b=Wc0g7fevCLQ0y4aVSYsQJlN3XbvkW7G0nmTVCxHSjplsb3rK8bYmtJq+FvY/U9+acL sLezw2D9lD7Xma8v4OEkrMSXWIqamqQkrJgewiBOEBqS3NGd5aMezeGOAfMzmO3ee12y WX+dk9C+IP8msjBjqjgro1l2FZQVF1tLRsFyH3Sjk/kcVYbN3vqn29D//3WWRgUL8eul IlX531hlHDS7IC1T8Yq8DoUrwrAf1UwQ1mwN7kkOdwGB3zws99oAKuILbwrKyuyvr+pu gcW15hQWHIfVku5P7wHFJuhS5kQYuspWMJ1AhLI/kQRSS20d+/ydoMioFkSNV5Dl6H7G IKEw== 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=5uzXa8Nq8BEcI0ZuswhY5o9lBuNoRfH3yZmZoYECPKc=; b=fr+32i1YnoliUU+DPAKLXeZ/MvW1SlmQK941unO+BcTnnFPOJfBk6Ztubs9p8HcV/p BULEmujNx12ikcCsh5WRfHCmiHNyCryZT2LsmV5gWyOIbUeIXENnkzb1QBYu64PhTHkn s8sfVVkomYiEpr6ZfO3jKICORtiBIsneOgaYoiSkqTYdX0YDG9w/jH6Ml2mk2Bq6o4Ub ijsb6tb+eOQOsH3kkiPoPE1tN1GlnIrLkYlX4J8Cwdie5sqCrxSYlIHswpQWPbpmMaez Cplkz58yJqhtBEU5+zVZvNtju1W0zPl9VSqi/4fTJq4PC1lWWqmkLWylC6vTXptSmyOX T3ZA== X-Gm-Message-State: APt69E3UC+eJ5w66IgBPDOYawU7Xfno8ujL2y9g5L2ADhux1kQQA+OCL f+WhRA+zcyPXEnKCEpkLSIc= X-Google-Smtp-Source: ADUXVKJL0yFqUFenXujb0S84Lr2JsYxIZwfunZvwFv7a3F7x2kH7nAREMijWPorh2gOeHP6+uv5mGA== X-Received: by 2002:a37:4ecb:: with SMTP id c194-v6mr1751219qkb.151.1528382824450; Thu, 07 Jun 2018 07:47:04 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , John Snow , Kevin Wolf , Max Reitz Date: Thu, 7 Jun 2018 11:46:42 -0300 Message-Id: <20180607144645.10187-2-f4bug@amsat.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180607144645.10187-1-f4bug@amsat.org> References: <20180607144645.10187-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:c09::242 Subject: [Qemu-devel] [PATCH v2 1/4] hw/block/fdc: Replace error_setg(&error_abort) by assert() 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 Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org 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 assert() instead of error_setg(&error_abort), 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. Likewise, don't error_setg(&error_abort, ...), use assert(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/fdc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index cd29e27d8f..7c1c57f57f 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -396,16 +396,9 @@ static int pick_geometry(FDrive *drv) nb_sectors, FloppyDriveType_str(parse->drive)); } + assert(type_match !=3D -1 && "misconfigured fd_format"); match =3D type_match; } - - /* No match of any kind found -- fd_format is misconfigured, abort. */ - if (match =3D=3D -1) { - error_setg(&error_abort, "No candidate geometries present in table= " - " for floppy drive type '%s'", - FloppyDriveType_str(drv->drive)); - } - parse =3D &(fd_formats[match]); =20 out: --=20 2.17.1 From nobody Mon Apr 29 06:55:38 2024 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 1528383068379806.6777190550978; Thu, 7 Jun 2018 07:51:08 -0700 (PDT) Received: from localhost ([::1]:58376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwFn-0003LZ-Kr for importer@patchew.org; Thu, 07 Jun 2018 10:51:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwC0-0000tp-Iq for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQwBx-0008Dy-Fx for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:12 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:47094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQwBx-0008Dk-Be; Thu, 07 Jun 2018 10:47:09 -0400 Received: by mail-qt0-x242.google.com with SMTP id h5-v6so10072608qtm.13; Thu, 07 Jun 2018 07:47:09 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id s128-v6sm11607363qkh.2.2018.06.07.07.47.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 07:47:08 -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=a9v5rXyUer+NC+52uyXBtpDOT41cCVI5YZQgURvB5A0=; b=Xltwkm8v6zJ4wyLhnEkTA7ETfoqqfdJ5x9ql1KxcDA/Tsc1A35Z6AOc0Snjk1IGvP9 qHm24BcNT1k6EReDuwlzJd43WnUMeBd0rdhRSd4EOvsm7HociE9ukPQfWKgQFQ7V4qK5 HRfd7yKxTNgc/URBlNf2vVIUwUe5QMY6F3IQqvJqYs4CtLe4gPDocH53nGjDyu+BZJ14 1+bSwJkcZOgLfnFqSGd/4HxTN6aVxC2Jby6WTUikhl2SAwxaLbMDgfyq4l+QK1dfQmxh GzXYVMcrgklh7W8IM3wCYQ8SnZpxF082JYOTwKq0EzEo93ikx/QVQqa/scRttW88gCpq kPCg== 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=a9v5rXyUer+NC+52uyXBtpDOT41cCVI5YZQgURvB5A0=; b=qmHz127Lr2IXvHPeH9Jj8zSMrBE4/HHKP6u+Zi9tGzo+FsLRpABZjjWaoWH99a+avV fGA4j3gWdlPg/3wV9o9nV2/c2sl75mGAtVJE7Uby9OMnx9e/kxdNWwbN6Xr6OC3pmp3n XI0b95uCzXEkkqhTx6U/vK60WyzA1qJv84+8vra8VSOJ79J/kB56hIueCg4+O/FOXIED qdjBNSCE70tAMDhh7626K6mZ5EemutQgvwdWefR8G3/idF0n2KM+kEDocIc4GCPHBQzF ekAcSQFQrrDZRO/oTnUZEPgGUptITK8LpwQFAdHF+r/fCYzsz8ZZc/Vd16WdjN+2hJMT ILgQ== X-Gm-Message-State: APt69E0Nhn+TITFWVY0TjdUss38Sgri+8PmW8xJZ7qyjQe6YHtZDJIoU npfUeAx53LAiEvjtQ4ehbT0= X-Google-Smtp-Source: ADUXVKJIOeVhZfYl/W/+2rYijKSWjh+5jCZgI3r9aeCUl/zfX0zJmCmJPELijMEAegrU0bW5xJy1jg== X-Received: by 2002:ac8:2d2e:: with SMTP id n43-v6mr2068021qta.106.1528382828877; Thu, 07 Jun 2018 07:47:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , David Gibson , Alexander Graf Date: Thu, 7 Jun 2018 11:46:43 -0300 Message-Id: <20180607144645.10187-3-f4bug@amsat.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180607144645.10187-1-f4bug@amsat.org> References: <20180607144645.10187-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::242 Subject: [Qemu-devel] [PATCH v2 2/4] hw/ppc/spapr_drc: Replace error_setg(&error_abort) by abort() 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 Maydell , qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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 abort() instead of error_setg(&error_abort), 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. Likewise, don't error_setg(&error_abort, ...), use assert(). Use abort() instead of the suggested assert() because the assertion is already verified by the switch case. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson --- hw/ppc/spapr_drc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 8a045d6b93..b934b9c9ed 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -366,7 +366,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const= char *name, break; } default: - error_setg(&error_abort, "device FDT in unexpected state: %d",= tag); + abort(); /* device FDT in unexpected state */ } fdt_offset =3D fdt_offset_next; } while (fdt_depth !=3D 0); --=20 2.17.1 From nobody Mon Apr 29 06:55:38 2024 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 1528383727600387.00236376919077; Thu, 7 Jun 2018 08:02:07 -0700 (PDT) Received: from localhost ([::1]:58455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwQQ-0003XD-RF for importer@patchew.org; Thu, 07 Jun 2018 11:02:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwC3-0000xM-Ti for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQwC2-0008GK-RA for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:15 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:36334) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQwC2-0008Fs-Ku; Thu, 07 Jun 2018 10:47:14 -0400 Received: by mail-qt0-x242.google.com with SMTP id o9-v6so10088654qtp.3; Thu, 07 Jun 2018 07:47:14 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id s128-v6sm11607363qkh.2.2018.06.07.07.47.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 07:47:13 -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=PFkg0TLgk1gyzNNfGViUVUX9xSwzd9Tgvb8msjV0AXs=; b=CYfX8mVEfIbLDRf46HfQz807HRJa7XwY3mMcm6mv2GMnRLKZxyesJQ0i+gwA+mKKu3 DAU5+rbQ3CHQpKWAmH6nxTZN53tGGzH6y1QN3OO73hV9hlz3okIdlmerKrLXJeGSBFAO /orefDy3DA8z/yXxPZNycIb05sDa24q8fA6P1wtlJJX/gzrTecrCRLBcr/NMjCHNuKsk i7aUXu3iXHnu3WOANTHPL1if9Gpu2NKY4w78XlOmM3dtjJyiDpTVgs8Cq2nwiCuVy5h2 vBhv6YPPRkp6EnSDUDu6KU+74f6cjP24f4MG/fU4sB2a1jq0ajP2qIMkUb2IeRS0j/Vo DJEQ== 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=PFkg0TLgk1gyzNNfGViUVUX9xSwzd9Tgvb8msjV0AXs=; b=e3vYYRb41FpKUX5x9QH8x0/ciEFsPEyBgozth+BQRzW0C5yQdc/mGoQ72cw8MSNVcL kEUy3Rtt9EfhdD2o7x4CdVh6cdbog/yz8wXLRaVIbliAGW8rrUz8gMs32J5Cn1a9xWrE oak9JbxBn77oMg4HYTeqcYtV1vNJtgp7eWx6t0yuITvUZweVHYUE09iwbUzO+jnfnJjy PoNo6W6w6Fa2FRe+D07YQ6DjvPhgm8sg8qIqxNxmf+CA/EiEqAnvzhfLfizgFF8LZRV1 FFGBIwnkvB2xLvktyvbVYGIA5o395CMezJdwRA60BlN7pbyEzb+GCvz5XLGnLorlh6qj oRzQ== X-Gm-Message-State: APt69E0rPDyEK+xNE65lWYu0YofCg4MVhHhr34vT4c45hD0Eytoic2hC RkZ/V/t2z80LeVS8mk0vE70= X-Google-Smtp-Source: ADUXVKIL4GBcDwlf+r7ZYdaFK/aHxeITne03yhbldBvNTsFGeZYBCCBduPqma7HBHYmOQRgEAY+QdQ== X-Received: by 2002:ac8:2a07:: with SMTP id k7-v6mr1376404qtk.300.1528382834120; Thu, 07 Jun 2018 07:47:14 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , Peter Maydell , Peter Crosthwaite , Alexander Graf Date: Thu, 7 Jun 2018 11:46:44 -0300 Message-Id: <20180607144645.10187-4-f4bug@amsat.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180607144645.10187-1-f4bug@amsat.org> References: <20180607144645.10187-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::242 Subject: [Qemu-devel] [PATCH v2 3/4] hw/arm/sysbus-fdt: 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: David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, qemu-devel@nongnu.org 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. This fixes CID 1352173: "Passing null pointer dt_name to qemu_fdt_node_path, which dereferences= it." And this also fixes: hw/arm/sysbus-fdt.c:322:9: warning: Array access (from variable 'node_p= ath') results in a null pointer dereference if (node_path[1]) { ^~~~~~~~~~~~ Fixes: Coverity CID 1352173 (Dereference after null check) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/sysbus-fdt.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index e4c492ea44..8e2784fa11 100644 --- a/hw/arm/sysbus-fdt.c +++ b/hw/arm/sysbus-fdt.c @@ -91,7 +91,7 @@ static void copy_properties_from_host(HostProperty *props= , int nb_props, r =3D qemu_fdt_getprop(host_fdt, node_path, props[i].name, &prop_len, - props[i].optional ? &err : &error_fatal); + &err); if (r) { qemu_fdt_setprop(guest_fdt, nodename, props[i].name, r, prop_len); @@ -102,6 +102,7 @@ static void copy_properties_from_host(HostProperty *pro= ps, int nb_props, } else { error_free(err); } + assert(props[i].optional); /* mandatory property not found */ } } } @@ -137,9 +138,9 @@ static void fdt_build_clock_node(void *host_fdt, void *= guest_fdt, =20 node_offset =3D fdt_node_offset_by_phandle(host_fdt, host_phandle); if (node_offset <=3D 0) { - error_setg(&error_fatal, - "not able to locate clock handle %d in host device tree= ", - host_phandle); + error_report("not able to locate clock handle %d in host device tr= ee", + host_phandle); + exit(1); } node_path =3D g_malloc(path_len); while ((ret =3D fdt_get_path(host_fdt, node_offset, node_path, path_le= n)) @@ -148,16 +149,16 @@ static void fdt_build_clock_node(void *host_fdt, void= *guest_fdt, node_path =3D g_realloc(node_path, path_len); } if (ret < 0) { - error_setg(&error_fatal, - "not able to retrieve node path for clock handle %d", - host_phandle); + error_report("not able to retrieve node path for clock handle %d", + host_phandle); + exit(1); } =20 r =3D qemu_fdt_getprop(host_fdt, node_path, "compatible", &prop_len, &error_fatal); if (strcmp(r, "fixed-clock")) { - error_setg(&error_fatal, - "clock handle %d is not a fixed clock", host_phandle); + error_report("clock handle %d is not a fixed clock", host_phandle); + exit(1); } =20 nodename =3D strrchr(node_path, '/'); @@ -300,34 +301,37 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev,= void *opaque) =20 dt_name =3D sysfs_to_dt_name(vbasedev->name); if (!dt_name) { - error_setg(&error_fatal, "%s incorrect sysfs device name %s", - __func__, vbasedev->name); + error_report("%s incorrect sysfs device name %s", + __func__, vbasedev->name); + exit(1); } node_path =3D qemu_fdt_node_path(host_fdt, dt_name, vdev->compat, &error_fatal); if (!node_path || !node_path[0]) { - error_setg(&error_fatal, "%s unable to retrieve node path for %s/%= s", - __func__, dt_name, vdev->compat); + error_report("%s unable to retrieve node path for %s/%s", + __func__, dt_name, vdev->compat); + exit(1); } =20 if (node_path[1]) { - error_setg(&error_fatal, "%s more than one node matching %s/%s!", - __func__, dt_name, vdev->compat); + error_report("%s more than one node matching %s/%s!", + __func__, dt_name, vdev->compat); + exit(1); } =20 g_free(dt_name); =20 if (vbasedev->num_regions !=3D 5) { - error_setg(&error_fatal, "%s Does the host dt node combine XGBE/PH= Y?", - __func__); + error_report("%s Does the host dt node combine XGBE/PHY?", __func_= _); + exit(1); } =20 /* generate nodes for DMA_CLK and PTP_CLK */ r =3D qemu_fdt_getprop(host_fdt, node_path[0], "clocks", &prop_len, &error_fatal); if (prop_len !=3D 8) { - error_setg(&error_fatal, "%s clocks property should contain 2 hand= les", - __func__); + error_report("%s clocks property should contain 2 handles", __func= __); + exit(1); } host_clock_phandles =3D (uint32_t *)r; guest_clock_phandles[0] =3D qemu_fdt_alloc_phandle(guest_fdt); --=20 2.17.1 From nobody Mon Apr 29 06:55:38 2024 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 1528383822701190.59001113530655; Thu, 7 Jun 2018 08:03:42 -0700 (PDT) Received: from localhost ([::1]:58463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwRy-0004Z4-4T for importer@patchew.org; Thu, 07 Jun 2018 11:03:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQwCA-00010x-07 for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQwC7-0008I5-5N for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:22 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:33723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQwC7-0008Ho-0Z for qemu-devel@nongnu.org; Thu, 07 Jun 2018 10:47:19 -0400 Received: by mail-qt0-x242.google.com with SMTP id l10-v6so4899369qtj.0 for ; Thu, 07 Jun 2018 07:47:18 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id s128-v6sm11607363qkh.2.2018.06.07.07.47.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 07:47:17 -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=f8L3PDupUWK0QJE501qgxRGNYceMpPxa0cK+Z5p74FA=; b=Ceu5GRt/jNMJ6txwHyIPcqVWfP/QlGcahPRXiK9fIB2oLmPrKcz7XeEDEVY6KkY+tR s/JQyxE4UH3M2khaWV54+nsw8QWkrCw40vtZ88cxir6cEXkUE8nwsXbjNwiWvJBDVat8 hDfcGRB5jYogwgba3y+qz7TFZkQrFpsinJh5PJsVcNa8jWN8bUcyf7d22C7qlitSJwaB BG3ajr8WBvBwbOy+Qp4fD+wVUZGDahvGxAGu6EuVdpduokxa5GxBZA63lWYrtlQlyXOB iepBmoO24MK965oEie6tHsBnQ8Vn5g1xRiJiLjqiRSN9e6eycF7GfLeoKvUFiYGMMa69 lXtg== 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=f8L3PDupUWK0QJE501qgxRGNYceMpPxa0cK+Z5p74FA=; b=QFkhHi+rRSedR0xGr5XKzNuLtbrUK2qMpJYYdoN9Ve2dKTUbRSwEqX6AMp8lndXnN1 8IsUwFVnjC4HPjgW4+1NouQJRxXLALwBZf6kwycf81Wp1IHqRRVRTLcsY7pUdgs+jaEW Sz1wPQpSOlkNrk2k7us8syQiSJVmmngoLXS/xcnWsJ4IFUJGt+51UpKBAMBLoAppv7ct K4QfOESpai7fN0SjbrY05InXJgWNAvOqiM1kAuGHgsU6SzqFmtB+lzDDla5vSaPF8fGK hO070uG72DJpzQm6Ka5DvczwVJMc6c4k75Hh2HEoiqnRSa6JGccTXVaZTvJjv4POZsOk s+Wg== X-Gm-Message-State: APt69E11BsOVN/mmdeGayG7nUKbR1DU4JcQ1vyTEMxD7hsbQ5/PU+NMt ZyGMjILf8o89COzaaf15bI4= X-Google-Smtp-Source: ADUXVKKPUFRwNgMvgW3IMThsFihTqAEO17bxBQsad90ynAWTvIQRyVh+CuCCt+VCeAbdI9q03/nJWQ== X-Received: by 2002:a0c:b2ca:: with SMTP id d10-v6mr1962127qvf.16.1528382838352; Thu, 07 Jun 2018 07:47:18 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , Peter Maydell , Peter Crosthwaite , Alexander Graf Date: Thu, 7 Jun 2018 11:46:45 -0300 Message-Id: <20180607144645.10187-5-f4bug@amsat.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180607144645.10187-1-f4bug@amsat.org> References: <20180607144645.10187-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::242 Subject: [Qemu-devel] [PATCH v2 4/4] 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: David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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.17.1