From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UujHw-0003vz-Co for qemu-devel@nongnu.org; Thu, 04 Jul 2013 09:09:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UujHs-000075-CP for qemu-devel@nongnu.org; Thu, 04 Jul 2013 09:09:32 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:121:10e4::3]:36916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UujHs-00006r-64 for qemu-devel@nongnu.org; Thu, 04 Jul 2013 09:09:28 -0400 From: Markus Armbruster Date: Thu, 4 Jul 2013 15:09:23 +0200 Message-Id: <1372943363-24081-8-git-send-email-armbru@redhat.com> In-Reply-To: <1372943363-24081-1-git-send-email-armbru@redhat.com> References: <1372943363-24081-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 7/7] vl: Tighten parsing of -machine option phandle_start List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, Alexander Graf Make it QEMU_OPT_NUMBER, so it gets parsed by generic code, which actually bothers to check for errors, rather than its user, which doesn't. Cc: Alexander Graf Signed-off-by: Markus Armbruster --- device_tree.c | 7 ++----- vl.c | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/device_tree.c b/device_tree.c index 0e7fe2d..10cf3d0 100644 --- a/device_tree.c +++ b/device_tree.c @@ -240,11 +240,8 @@ uint32_t qemu_devtree_alloc_phandle(void *fdt) * which phandle id to start allocting phandles. */ if (!phandle) { - const char *phandle_start = qemu_opt_get(qemu_get_machine_opts(), - "phandle_start"); - if (phandle_start) { - phandle = strtoul(phandle_start, NULL, 0); - } + phandle = qemu_opt_get_number(qemu_get_machine_opts(), + "phandle_start", 0); } if (!phandle) { diff --git a/vl.c b/vl.c index fb69f22..bea1a10 100644 --- a/vl.c +++ b/vl.c @@ -409,7 +409,7 @@ static QemuOptsList qemu_machine_opts = { .help = "Dump current dtb to a file and quit", }, { .name = "phandle_start", - .type = QEMU_OPT_STRING, + .type = QEMU_OPT_NUMBER, .help = "The first phandle ID we may generate dynamically", }, { .name = "dt_compatible", -- 1.7.11.7