Received: from eggs.gnu.org ([2001:4830:134:3::10]:52449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJein-00029X-MO for qemu-devel@nongnu.org; Fri, 06 Feb 2015 03:57:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJeij-0003ov-6t for qemu-devel@nongnu.org; Fri, 06 Feb 2015 03:57:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJeii-0003oR-Vl for qemu-devel@nongnu.org; Fri, 06 Feb 2015 03:57:01 -0500 From: Markus Armbruster References: <1422966857-6776-1-git-send-email-arei.gonglei@huawei.com> <1422966857-6776-2-git-send-email-arei.gonglei@huawei.com> Date: Fri, 06 Feb 2015 09:56:42 +0100 In-Reply-To: <1422966857-6776-2-git-send-email-arei.gonglei@huawei.com> (arei gonglei's message of "Tue, 3 Feb 2015 20:34:15 +0800") Message-ID: <87oap7wh85.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 1/3] bootdevice: remove the check about boot_set_handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: peter.huangpeng@huawei.com, dvaleev@suse.de, qemu-devel@nongnu.org, agraf@suse.de writes: > From: Gonglei > > The reset logic can be done by both machine reset and > boot handler. So we shouldn't return error when the boot > handler callback don't be set. > > Signed-off-by: Gonglei > Reviewed-by: Alexander Graf > --- > bootdevice.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/bootdevice.c b/bootdevice.c > index 5914417..52d3f9e 100644 > --- a/bootdevice.c > +++ b/bootdevice.c > @@ -51,19 +51,15 @@ void qemu_boot_set(const char *boot_order, Error **errp) > { > Error *local_err = NULL; > > - if (!boot_set_handler) { > - error_setg(errp, "no function defined to set boot device list for" > - " this architecture"); > - return; > - } > - > validate_bootdevices(boot_order, &local_err); > if (local_err) { > error_propagate(errp, local_err); > return; > } > > - boot_set_handler(boot_set_opaque, boot_order, errp); > + if (boot_set_handler) { > + boot_set_handler(boot_set_opaque, boot_order, errp); > + } > } > > void validate_bootdevices(const char *devices, Error **errp) Two callers: * HMP command boot_set Before your patch: command fails when the target doesn't support changing the boot order. After your patch: command silently does nothing. I'm afraid that's a regression. Aside: looks like there's no QMP command. * restore_boot_order() No change yet, because restore_boot_order() ignores errors. But PATCH 3 will make it abort on error. I guess that's why you make the change here. To avoid the regression, you could drop PATCH 1, and change PATCH 3 to something like - qemu_boot_set(normal_boot_order, NULL); + if (boot_set_handler) { + qemu_boot_set(normal_boot_order, &error_abort); + } There are other ways, but this looks like the simplest one.