From patchwork Tue Dec 16 13:04:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 421886 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 03C161400E9 for ; Wed, 17 Dec 2014 00:05:16 +1100 (AEDT) Received: from localhost ([::1]:44619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0roP-0006W5-W7 for incoming@patchwork.ozlabs.org; Tue, 16 Dec 2014 08:05:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0ro0-00069E-6t for qemu-devel@nongnu.org; Tue, 16 Dec 2014 08:04:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0rnv-0002tt-6c for qemu-devel@nongnu.org; Tue, 16 Dec 2014 08:04:48 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:50907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0rnu-0002nU-K7; Tue, 16 Dec 2014 08:04:43 -0500 Received: from 172.24.2.119 (EHLO szxeml416-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CGD41268; Tue, 16 Dec 2014 21:04:36 +0800 (CST) Received: from [127.0.0.1] (10.177.19.102) by szxeml416-hub.china.huawei.com (10.82.67.155) with Microsoft SMTP Server id 14.3.158.1; Tue, 16 Dec 2014 21:04:34 +0800 Message-ID: <54902DCA.7040201@huawei.com> Date: Tue, 16 Dec 2014 21:04:10 +0800 From: Gonglei User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Peter Maydell References: <1418721773-29042-1-git-send-email-arei.gonglei@huawei.com> <1418721773-29042-6-git-send-email-arei.gonglei@huawei.com> In-Reply-To: X-Originating-IP: [10.177.19.102] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.64 Cc: Blue Swirl , Alexander Graf , "qemu-ppc@nongnu.org" , QEMU Developers , "Michael S. Tsirkin" Subject: Re: [Qemu-devel] [PULL 5/5] bootdevice: add Error **errp argument for QEMUBootSetHandler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 2014/12/16 20:42, Peter Maydell wrote: > On 16 December 2014 at 09:22, wrote: >> @@ -412,9 +411,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, >> object_property_set_link(OBJECT(machine), OBJECT(s), >> "rtc_state", &error_abort); >> >> - if (set_boot_dev(s, boot_device)) { >> - exit(1); >> - } >> + set_boot_dev(s, boot_device, &error_abort); > > This turns a "print error message and exit" path into > an abort(), which doesn't seem right (this can be triggered > by bad user input arguments, yes?). error_abort should > only be used in cases where you would assert() if there > was an error (ie where it would be a QEMU bug if it > happened). > Yes, agree. How does use a incremental patch fix this, Peter? Regards, -Gonglei diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 99deba6..d7822b8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -364,6 +364,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, FDriveType fd_type[2] = { FDRIVE_DRV_NONE, FDRIVE_DRV_NONE }; static pc_cmos_init_late_arg arg; PCMachineState *pc_machine = PC_MACHINE(machine); + Error *local_err = NULL; /* various important CMOS locations needed by PC/Bochs bios */ @@ -411,7 +412,10 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, object_property_set_link(OBJECT(machine), OBJECT(s), "rtc_state", &error_abort); - set_boot_dev(s, boot_device, &error_abort); + set_boot_dev(s, boot_device, &local_err); + if (local_err) { + exit(1); + } /* floppy type */ if (floppy) {