From patchwork Tue May 29 17:48:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 922291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sxlmLz0w"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40wLp11Tz7z9s01 for ; Wed, 30 May 2018 03:49:29 +1000 (AEST) Received: from localhost ([::1]:34245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNikQ-0004SN-Qi for incoming@patchwork.ozlabs.org; Tue, 29 May 2018 13:49:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNija-0004HI-ER for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNijZ-00056V-KG for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:34 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:35579) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNijZ-000569-FJ; Tue, 29 May 2018 13:48:33 -0400 Received: by mail-qt0-x243.google.com with SMTP id j1-v6so19747438qtp.2; Tue, 29 May 2018 10:48:33 -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=iXY9fdgQyeiUJ3DYGO4lnsniAxnnHiSU85xc45rB4Ik=; b=sxlmLz0wRju7geT2kr2wh8rxPCzPM+Evj/sTaTfoiZ83CYjWudDNo/DUr8LVZKYFjY Vat/FYEd3owhYGoSMFyTVYN68KG1IuLuT4p3Jcu9gpxOYovsaeTVX4bX0czptST7tcp6 S5ZVOHvt29mwJ+7McYd5HSfagY+0LYtrtvQyDmGoQ5boSWEj5g66gMcPp4TBcYdWncVT ystRUk5SNuF+Cn4qtxfIud8xoabCK5dm9RdaVvdGdccqhUYvkffZpSfa//0ymkWm02pa jRjgzshfvihKhYoVMntAb8HYQPvEgffytoJ1XTLcxOzUVHzPKEyY7DqCzNtbbi7+5l3c NdNg== 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=iXY9fdgQyeiUJ3DYGO4lnsniAxnnHiSU85xc45rB4Ik=; b=cYunHk4U2oWQN280XEj2AGLAae7/pMDPOeqCBOunfTIdnDrXei7wq5B477yAjN93t7 itnJRAcJn2xD9uuDVqsdJzhVI9sUDP/ruP3qx2RqNv//tpmST6ej5zurBXgyUprdTJ0s 7I53HGJbJR7KRwG5sZnwLENqevmq041iQ6aI7bWiq6PXzOuHAbPq45U5t3UIikW7qcjF lm4jO9Zwt4dI0SRAdVFhvjHiE2AyM3vmYFQputscJqVBpLkuDGR/gAL6VMxeDTj2F7uL +8yvMnqsHfGltXwZfsfZ3YIUoXSAy1Q9JuHxCPiHlpWPTGAuMZl6n4SicI7ohTibL1bO CtcQ== X-Gm-Message-State: ALKqPwd6c2F63cO9+Tyq4QsgWoISnqVLXuJDYp88kw4W/keABrqi3xjj MCLFF8eZLWK3fJ2LBSiZUpdgmX4A7jc= X-Google-Smtp-Source: ADUXVKKxvKcXMYP7VgR8Ko5qpqMSejHBZ8rcuGP3ayGsFY/Vm9vjT7YrPS3j5hCtmeAUPtwRaOATxg== X-Received: by 2002:a0c:c206:: with SMTP id l6-v6mr16924829qvh.51.1527616112938; Tue, 29 May 2018 10:48:32 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id q8-v6sm25564308qtb.13.2018.05.29.10.48.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 10:48:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , John Snow , Kevin Wolf , Max Reitz Date: Tue, 29 May 2018 14:48:18 -0300 Message-Id: <20180529174821.19964-2-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529174821.19964-1-f4bug@amsat.org> References: <20180529174821.19964-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PATCH 1/4] hw/block/fdc: Replace error_setg(&error_abort) by error_report() + 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 , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= , qemu-block@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Use error_report() + 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 error message already got displayed. Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: John Snow Acked-by: John Snow --- hw/block/fdc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index cd29e27d8f..048467c00b 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -401,9 +401,10 @@ static int pick_geometry(FDrive *drv) /* No match of any kind found -- fd_format is misconfigured, abort. */ if (match == -1) { - error_setg(&error_abort, "No candidate geometries present in table " - " for floppy drive type '%s'", - FloppyDriveType_str(drv->drive)); + error_report("No candidate geometries present in table " + " for floppy drive type '%s'", + FloppyDriveType_str(drv->drive)); + abort(); } parse = &(fd_formats[match]); From patchwork Tue May 29 17:48:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 922292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UshORdZq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40wLp238nLz9s01 for ; Wed, 30 May 2018 03:49:30 +1000 (AEST) Received: from localhost ([::1]:34246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNikR-0004U8-Tl for incoming@patchwork.ozlabs.org; Tue, 29 May 2018 13:49:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNijd-0004Jp-FG for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNijc-00058w-QZ for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:37 -0400 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:40075) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNijc-00058d-MR; Tue, 29 May 2018 13:48:36 -0400 Received: by mail-qt0-x244.google.com with SMTP id h2-v6so19738453qtp.7; Tue, 29 May 2018 10:48:36 -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=xFcvacd5fYpg2JoX466M0K1Xkl31AcXKGFs5SZVFTDg=; b=UshORdZqyc/809CRIz3itIAWHIuN28VXekcuhdBRKKp8bssOZf6Sa+lSuUAkarkrpM BvmSv/akpB3FHiY+VYVrFkontDFDmZIzJEBBQjK+DGlU9/s15fkJpr+Y6yZHlxLgg8jy UUKF0HQSr5MgkMdu/VKqAq7s6J9vaxX4kl3TYS8cfJuX8vxWBislNPYhrfkB3Mxf9lJc 9/bGvlJcGyqi2rcnXynYFDPfEDTcqxbD+TJOQb1eeNA3thumskTaEZEiwDh3RI6aExD6 cXxqjjkhlKrRm2RJTzyCUtlP+YRBH1A+nK/qTb7ThW23SNl5DqG/yhnGFebi+YNSOSuR IjXw== 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=xFcvacd5fYpg2JoX466M0K1Xkl31AcXKGFs5SZVFTDg=; b=NAtj0QkvIQeKbZTfvgUkcF5mDW7C4tYxcVnk7vCFOiUg/bZS5tQE/isyX2casN18Et lL/dOqGLUh8q/MwoaQljjzRvQDs6HvA4MWB6PSFtw+OGHL+S2avqDBVur3EbwxHxxvNw UNFVT2GINcCf8tpQGsBVFW6Y6uDRSVMyvif/9bzaZ5WzfVpE9PTfhdsY65ONIz9HhS1N zYr/TV/4wXUQKOdoii9G7JmVMDQhq9P39K4cveQk2mEdckDCHTJyJctHphtiaJP+BhE2 QHSLRYeqCjouYG6Wr14rBwvm82ZGi0y/HJaVPvtpsEyAvNRYHag6M76HGrSWdjsibzjc Dinw== X-Gm-Message-State: ALKqPwcZo6ESdSE6EseS9LHX7UAtpapKx//2/futZhDMrx8oYNgKt2cg mfxCKDa2SRYSnFamd13v+NLDwB2Bebo= X-Google-Smtp-Source: ADUXVKK1XESPF0FQzZ5mGY5TxhB9wGFRWuOxvXYP9qp0BDnA4rfmraX+DvuhyYl2t/oZuQ5GqQNh+Q== X-Received: by 2002:a0c:9621:: with SMTP id 30-v6mr16089763qvx.127.1527616116110; Tue, 29 May 2018 10:48:36 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id q8-v6sm25564308qtb.13.2018.05.29.10.48.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 10:48:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , David Gibson , Alexander Graf Date: Tue, 29 May 2018 14:48:19 -0300 Message-Id: <20180529174821.19964-3-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529174821.19964-1-f4bug@amsat.org> References: <20180529174821.19964-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::244 Subject: [Qemu-devel] [PATCH 2/4] hw/ppc/spapr_drc: Replace error_setg(&error_abort) by error_report() + 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_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Use error_report() + 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 error message already got displayed. Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/spapr_drc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 8a045d6b93..2edb7d1e9c 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -366,7 +366,8 @@ 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); + error_report("device FDT in unexpected state: %d", tag); + abort(); } fdt_offset = fdt_offset_next; } while (fdt_depth != 0); From patchwork Tue May 29 17:48:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 922294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rZyx9OJm"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40wLs174xqz9s01 for ; Wed, 30 May 2018 03:52:05 +1000 (AEST) Received: from localhost ([::1]:34264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNimx-00072F-No for incoming@patchwork.ozlabs.org; Tue, 29 May 2018 13:52:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNiji-0004Oz-8t for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNijg-0005Bp-2D for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:42 -0400 Received: from mail-qt0-x234.google.com ([2607:f8b0:400d:c0d::234]:35365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNijf-0005BS-U5; Tue, 29 May 2018 13:48:40 -0400 Received: by mail-qt0-x234.google.com with SMTP id j1-v6so19747899qtp.2; Tue, 29 May 2018 10:48:39 -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=SjlAvDx0RUdVe69Yfg51ieJ0bfkH+XskY1wYVXORZd0=; b=rZyx9OJm0uFQOfAjeNBt9sHOFkJzOyLSqUBSKpq2PDxPdi4/jIuGaQzSM+DKZmf0K4 RaKQ471PDbtV01iGegJQvNJIgQgk4dqCaN3Z7WoTJK/2JT1ZpAd1/BobTOdyvwvJ9TPg 7BTXamyIUU+itd40qT7l2VWHWqJ3QElrm0ivG/tsXUowjlVB+qmSB+wSyyCVGjBXrOGT H5dsr7P4m8InC0w9XvW6yW7XRJmWBzajn7SsNqVSpj9cGdrQZrlaXmqn06QeFbEIv/z3 Jz33ya/x088ySWZLbRBIlDUWLtl84sik9t53OrBrA3DqPtgB4P+jM33lhD5K3H/EDvay T6sQ== 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=SjlAvDx0RUdVe69Yfg51ieJ0bfkH+XskY1wYVXORZd0=; b=tsw1Zv9Xx9QxYvhbVj47s79DKuOeAsCxenxA8Z0ZYPmrlqI+9JT9CbC6mZb59fPa33 Cda44AoHJI3MBZ+AiO+CnavD1NQUmmb8LW440SGTFWcQ2OyIKhoAOHTSRSS0Ra/VBvFW qusdJxaRjYGw5hV/a498opF3sYhlvjXpSwV19WukCeVrIzPkzWL4JgukG1/hLRVILOA/ nmrtVT5pVPnowUgbuT5GqzG0WZZG3UPqzShPUs9JEg5uBEltYez3qVc9a5PBeLvn4SSH ai7ktkOHXIOuHidAOXS6SkzgDhsY6kTUJhRzOZS7wDvQNuFH6lGHiG01yzL/p/sunzh3 wMXA== X-Gm-Message-State: ALKqPweSLB49Hjow+MVKkhneULKV4XxB92Vkt/Y/kCymnWx3rCVlABX4 PihCa/YktbC62iUQwim7wTj5i1P0Xyw= X-Google-Smtp-Source: ADUXVKI/6XbBz5HLFI4oGvBAX894ibZZzsSP01R73yT3Oj1fXmkZo+u0xtfAegIl9j0/Cqog0iqE5A== X-Received: by 2002:ac8:7217:: with SMTP id a23-v6mr16590947qtp.243.1527616119319; Tue, 29 May 2018 10:48:39 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id q8-v6sm25564308qtb.13.2018.05.29.10.48.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 10:48:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , Peter Maydell , Peter Crosthwaite , Alexander Graf Date: Tue, 29 May 2018 14:48:20 -0300 Message-Id: <20180529174821.19964-4-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529174821.19964-1-f4bug@amsat.org> References: <20180529174821.19964-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::234 Subject: [Qemu-devel] [PATCH 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_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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_path') results in a null pointer dereference if (node_path[1]) { ^~~~~~~~~~~~ Fixes: Coverity CID 1352173 (Dereference after null check) Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- hw/arm/sysbus-fdt.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index e4c492ea44..3af87fc184 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 = 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,10 @@ static void copy_properties_from_host(HostProperty *props, int nb_props, } else { error_free(err); } + if (!props[i].optional) { + /* mandatory property not found: bail out */ + exit(1); + } } } } @@ -137,9 +141,9 @@ static void fdt_build_clock_node(void *host_fdt, void *guest_fdt, node_offset = fdt_node_offset_by_phandle(host_fdt, host_phandle); if (node_offset <= 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 tree", + host_phandle); + exit(1); } node_path = g_malloc(path_len); while ((ret = fdt_get_path(host_fdt, node_offset, node_path, path_len)) @@ -148,16 +152,16 @@ static void fdt_build_clock_node(void *host_fdt, void *guest_fdt, node_path = 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); } r = 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); } nodename = strrchr(node_path, '/'); @@ -300,34 +304,37 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque) dt_name = 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 = 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); } 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); } g_free(dt_name); if (vbasedev->num_regions != 5) { - error_setg(&error_fatal, "%s Does the host dt node combine XGBE/PHY?", - __func__); + error_report("%s Does the host dt node combine XGBE/PHY?", __func__); + exit(1); } /* generate nodes for DMA_CLK and PTP_CLK */ r = qemu_fdt_getprop(host_fdt, node_path[0], "clocks", &prop_len, &error_fatal); if (prop_len != 8) { - error_setg(&error_fatal, "%s clocks property should contain 2 handles", - __func__); + error_report("%s clocks property should contain 2 handles", __func__); + exit(1); } host_clock_phandles = (uint32_t *)r; guest_clock_phandles[0] = qemu_fdt_alloc_phandle(guest_fdt); From patchwork Tue May 29 17:48:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 922293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vJ+NZ6mk"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40wLpS3cf0z9s01 for ; Wed, 30 May 2018 03:49:52 +1000 (AEST) Received: from localhost ([::1]:34248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNiko-0004lU-4E for incoming@patchwork.ozlabs.org; Tue, 29 May 2018 13:49:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNijj-0004RE-V9 for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNijj-0005E6-6L for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:44 -0400 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:36198) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNijj-0005Db-2E for qemu-devel@nongnu.org; Tue, 29 May 2018 13:48:43 -0400 Received: by mail-qk0-x241.google.com with SMTP id a195-v6so9610533qkg.3 for ; Tue, 29 May 2018 10:48:42 -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=9b2kXBrj1AabFfsmzeMkrgjgJflJlNT/oCZP9gK6GDk=; b=vJ+NZ6mkU5yROJG3rblp+ND4g0bRisXfGeb8oQL80emTccUxugpe6ls/6UqXHfKjD/ M33ypPXzFSE4/m/vNTuNLo1HvVlLvFbq9dnTs2T3gkROMum9EAFfmI7aWHESrEp8IVji Q1T9tWCVHSfG2umlZbWIgnolQTqqdzjgncL3bOPWDklBhK29fD4pHOQV3mS5qJ+kAIf2 edvns4cikTBoNHgOVzKUsH7XoG6Pq4jQ7WOg92GG4ZM7kYY0Ccqrl7kKDPK81mWrb050 LAe6yhzaNEO6e8hT91qMAfmNOcMNCPyH0RF48YrH22fV17bhx893xOSrYNZ8+vSAu/V0 a5Yg== 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=9b2kXBrj1AabFfsmzeMkrgjgJflJlNT/oCZP9gK6GDk=; b=MwJRn7IQlaXdQi4jQbK1sUJFfqQnCA6re6hIXEMBN/vPeUpdjzTtNErOlFqwd9VpLb dIB+ApuDtwJUkIka3IGO/kVLu6cNC2/gp9MShFL3aY7LaOdvjH2iJ0xayVhfZLs6zqwH 79YfWPHNf/SGlKBtIkX12xfECrr7/4F1gViPINYb3DvEJ8Kwd8eQcPhiSBp+GWMrOw8M 8mPp6C7auh8QMw2MAuGFfveio4w3H9PFybYJLjQMCVAMCChAjbvgSQ2Tp5kYC47c9hZI zShMrEoteOC4/KjD2Juw17R32RshsDXQzC+rQF2sGXUaFJcv5LJuiGGxy6EsMx6XSbgU FHDA== X-Gm-Message-State: ALKqPwdYHArhyxN/64nfoMViIcWjjlFneyJ9Wy5x/6H2zw4ccI9QpKk1 ryX7g7k6FLMnlX93Dv3wPJQ= X-Google-Smtp-Source: ADUXVKJq1u2kDKPKWN63s4Kl/sII763Tw9iYXtcnx11Dv/VVy2SYLEJ6jzfLiwF3nU/1GEynkzUlWw== X-Received: by 2002:a37:a85:: with SMTP id 127-v6mr15507472qkk.401.1527616122412; Tue, 29 May 2018 10:48:42 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id q8-v6sm25564308qtb.13.2018.05.29.10.48.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 10:48:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eric Blake , Markus Armbruster , Peter Maydell , Peter Crosthwaite , Alexander Graf Date: Tue, 29 May 2018 14:48:21 -0300 Message-Id: <20180529174821.19964-5-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529174821.19964-1-f4bug@amsat.org> References: <20180529174821.19964-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::241 Subject: [Qemu-devel] [PATCH 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_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- 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 *dirname) const char *parent_node; if (strstr(dirname, root_dir) != 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 = &dirname[strlen(SYSFS_DT_BASEDIR)]; d = 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); } while ((de = readdir(d)) != NULL) { @@ -162,7 +163,8 @@ static void read_fstree(void *fdt, const char *dirname) tmpnam = g_strdup_printf("%s/%s", dirname, de->d_name); if (lstat(tmpnam, &st) < 0) { - error_setg(&error_fatal, "%s cannot lstat %s", __func__, tmpnam); + error_report("%s cannot lstat %s", __func__, tmpnam); + exit(1); } if (S_ISREG(st.st_mode)) { @@ -170,8 +172,9 @@ static void read_fstree(void *fdt, const char *dirname) gsize len; 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); } if (strlen(parent_node) > 0) { @@ -206,9 +209,9 @@ void *load_device_tree_from_sysfs(void) host_fdt = 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; }