From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIy56-0006jl-HZ for qemu-devel@nongnu.org; Tue, 12 Jan 2016 07:29:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIy53-0007mJ-Cp for qemu-devel@nongnu.org; Tue, 12 Jan 2016 07:29:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIy53-0007m5-7e for qemu-devel@nongnu.org; Tue, 12 Jan 2016 07:29:45 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id E18DDC07584E for ; Tue, 12 Jan 2016 12:29:44 +0000 (UTC) From: Gerd Hoffmann Date: Tue, 12 Jan 2016 13:29:34 +0100 Message-Id: <1452601779-5790-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1452601779-5790-1-git-send-email-kraxel@redhat.com> References: <1452601779-5790-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/7] console: use qemu_console_lookup_by_device_name in qemu_input_handler_bind List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcelo Tosatti , Markus Armbruster , Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- ui/input.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/ui/input.c b/ui/input.c index 006667b..1409e01 100644 --- a/ui/input.c +++ b/ui/input.c @@ -81,19 +81,12 @@ void qemu_input_handler_bind(QemuInputHandlerState *s, const char *device_id, int head, Error **errp) { - DeviceState *dev; QemuConsole *con; + Error *err = NULL; - dev = qdev_find_recursive(sysbus_get_default(), device_id); - if (dev == NULL) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", device_id); - return; - } - - con = qemu_console_lookup_by_device(dev, head); - if (con == NULL) { - error_setg(errp, "Device %s is not bound to a QemuConsole", device_id); + con = qemu_console_lookup_by_device_name(device_id, head, &err); + if (err) { + error_propagate(errp, err); return; } -- 1.8.3.1