From patchwork Thu Nov 22 16:48:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 13075 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5BC8723FC1 for ; Thu, 22 Nov 2012 16:48:56 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 01C73A19E37 for ; Thu, 22 Nov 2012 16:48:55 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so3280873iag.11 for ; Thu, 22 Nov 2012 08:48:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=Cy/+hSXw3jo1MHGLko00FXHjWG8goWkTOmviHjAcSOg=; b=jIqLzcObrEIeFbiOB0OZxcF71IbCrRFlQ1t4eZcin5UnmECsM3AzUe/yA05PViFvDe ZsIdBbOoigpzWJj2E1Go1TSeXG/CfTCVv3yURZndIALWh6QdDzHrc2L6k8hJ+ShMc6UV 0Tnf1itijCSgtedYZLTDvrh8wysGTBGxOcrDIc/vs6WFXLEb6CcN/7PRdvTbN1dnIV3b lfT0f9y0utGpO6O1p7QwsKj1EcKGzgb6CbE6tzpF+elq3907RMFl/iTW9bhaRBndVoWr WVuxbSXP4aU13wGL2IrjOve5R5gDmW9nUbS6evT9wPxpBcTcPDj13fgJA9T343fNeysU /stw== Received: by 10.50.213.34 with SMTP id np2mr1110849igc.57.1353602935456; Thu, 22 Nov 2012 08:48:55 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp236179igt; Thu, 22 Nov 2012 08:48:54 -0800 (PST) Received: by 10.216.227.137 with SMTP id d9mr470555weq.205.1353602934100; Thu, 22 Nov 2012 08:48:54 -0800 (PST) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id d4si3385245wix.30.2012.11.22.08.48.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Nov 2012 08:48:54 -0800 (PST) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1TbZxF-0007WN-5T; Thu, 22 Nov 2012 16:48:45 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , Li Zhang , Anthony Liguori Subject: [PATCH for-1.3] vl.c: Fix broken -usb option Date: Thu, 22 Nov 2012 16:48:45 +0000 Message-Id: <1353602925-28887-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQkWTHalwkvhqk1lfw559QJx2Zyj8/VurPOWtxK0IMbOpNt+nxcsVrArlIysJhGVkSkT4YTm Commit 094b287f0b accidentally broke the "-usb" command line option, so it would have no effect if the user had not specified any machine options at that point. (the return value from 'qemu_opts_find(qemu_find_opts("machine"), 0);' is NULL if there are no user specified options, so it is only to be used for looking up an option, not when trying to set one.) Similarly, would '-usbdevice' no longer cause USB to default to enabled. Fix this regression by using the same style of code for forcing the usb=on machine option that we use for other aliases such as '-enable-kvm'. Signed-off-by: Peter Maydell --- For 1.3 as this is a regression which would presumably cause breakage for migrations and existing working qemu command lines. vl.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/vl.c b/vl.c index c8e9c78..a3ab384 100644 --- a/vl.c +++ b/vl.c @@ -3273,16 +3273,12 @@ int main(int argc, char **argv, char **envp) break; } case QEMU_OPTION_usb: - machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); - if (machine_opts) { - qemu_opt_set_bool(machine_opts, "usb", true); - } + olist = qemu_find_opts("machine"); + qemu_opts_parse(olist, "usb=on", 0); break; case QEMU_OPTION_usbdevice: - machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); - if (machine_opts) { - qemu_opt_set_bool(machine_opts, "usb", true); - } + olist = qemu_find_opts("machine"); + qemu_opts_parse(olist, "usb=on", 0); add_device_config(DEV_USB, optarg); break; case QEMU_OPTION_device: