From patchwork Thu Aug 22 12:23:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 821331 Delivered-To: patch@linaro.org Received: by 2002:adf:e98a:0:b0:367:895a:4699 with SMTP id h10csp1152486wrm; Thu, 22 Aug 2024 05:24:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUZ152UkuAF6pb786puqtgvTIWURYgio1p8wkO/0d6MP5ctXATZ2ZLmw4AfcwUHqpUs8KdvZA==@linaro.org X-Google-Smtp-Source: AGHT+IG4pye9RbbNo7+hHeAjLeWQwCiZINc2v2drH1Vs5eHwqReJW7utqwJPQhJKt6CfXo9xRHcv X-Received: by 2002:a05:6870:82a2:b0:258:5143:a21a with SMTP id 586e51a60fabf-2737ef0023bmr6128837fac.13.1724329445929; Thu, 22 Aug 2024 05:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724329445; cv=none; d=google.com; s=arc-20160816; b=CMTDaPf8fbB04F6YHfhsoEyUtITWAQWzS2s/E3mvssulpiyHowOW0sOLeQKcEuJOWT wb5LKUdQdbjKUnJVQdkRpjhks76dinbIe74YzVKlJIUexfauwG0FwGag5g+/XYbm/0gL rSYQc5r0MMnJjjfMC2Cgov2bB0ZqAEBJGNMmdT0aREePFUnuivGMtRzeHB5t5zqR64gc I3jrq9G+OamqrMAuvJ9jcl9FZZpUhE20FFwF/uZWTJ5fhHBZhLQwFXoGvACEcu/oCJDS SdjM3qr3T0+g87rdNive3ZxNtnNBCvhcciNumuQXBK4Wl71nSzxJ9mZaSG8c/pKId14Z cKvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=fuk1+Jjiy0dwyOWZxHuc1mCwVnRsvW+sH5qBxImq/Bk=; fh=68MFSwuXP/MALClsxUr6O2CeF0d2be+bcQUu5kuPkYw=; b=j80VvrgznBEweYE1kNGdHJzrkQ/nhon3WFn0hGB4jcOwwbDjtSt16i3Oqst3yqtTJH 9TGrA+12MAsmCr1O3smMGxOnmV4IZ9TXiTYiEc0hRgXv/3KAjYK3z6qA0gRAZZ7Ubu8r mvFtvFgi/q2bNiZggJO3xIeNZeG1Z3QGLg4P5ECXlk2zamFNK1OJm6rL5zyeKsddDR2X pAlMAhio7RBrwfJF2ow030Jnn8/H5eHguUEJ1r5nROn8KwhwG2RSFBxVMazze/FIHEfT gCPQ/xwGY8FUXHJN29lmsjXlKsQvIQUNGuFiJOxdNmij6Q0mYc6AfAv+KfHHjkJu4I6E hImA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cBEndfJ0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a67f34789asi154665485a.175.2024.08.22.05.24.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Aug 2024 05:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cBEndfJ0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sh6qV-0007wT-CR; Thu, 22 Aug 2024 08:23:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sh6qT-0007qM-Rs for qemu-devel@nongnu.org; Thu, 22 Aug 2024 08:23:18 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sh6qQ-0004cn-RJ for qemu-devel@nongnu.org; Thu, 22 Aug 2024 08:23:17 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-428e3129851so5436865e9.3 for ; Thu, 22 Aug 2024 05:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724329392; x=1724934192; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fuk1+Jjiy0dwyOWZxHuc1mCwVnRsvW+sH5qBxImq/Bk=; b=cBEndfJ0bifdcYbK1LlNLyt5LmLcx3DKPmReAe8kmaWSdZjBvpyWhuZLbcGjVgZlun qY5jRsSCk9cd/vInABAhLUVyj7M8N5Qmh93b5eBJpapvCRDT3EB32jbhwrIAtP2zss9v e0NHELBfkaF5hpcKaa7cDcuLf25nnQhNwoGB/b5wPh1fhnC+TvkHwaf9g6bP+pxvSG+y SNzXi8r7loHyYEyEa6dchnnlkh3HNsEF6KV5JYkpNDxtyO7h8cWrC6nDedftjyshJPio OAEGMYrAb7vXwNkWcSShWdp1nk4N5nQYkNPK/BDgRYWzQxEzSQI3szF2NeKpjnRk9stR t7sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724329392; x=1724934192; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fuk1+Jjiy0dwyOWZxHuc1mCwVnRsvW+sH5qBxImq/Bk=; b=aHASQPdAi/pywbJOmWsAbvpT22XZDQWHyeRngq31MsnHc+0EJy+0ZYcbHblLvQwtU3 IT4iaxQFDVgANoh31dXBWUUkSpWdkegKezA6YeyK4ZXlY11i2ZMowVj960muD3rA6Q+e sJJXAYwFCm+qZI1ueHJfRZbqUVCL4ag/pqQmgBBqc/qH0vWONcuwAO2Fosnh1SJyH5rM tPfjZW1oHQfE6sENZzmi5F92ind4QNwApQrEeV/F3cF6H3jM29uQG+8/8enlgmURYwFG MKYzJ36PRL6PVtnBW9mdiVIL4GZJpj3GtZqvX5uM4nKiXCo62d+vMLPJMI2OLB++Mq52 Z9yQ== X-Gm-Message-State: AOJu0Ywy4QIV4uu+yfRENk3PgIewtftt1Jxq+b1KY+h1zngQdYrpC5Gr mTx0JXNMEFHlK7qUSF0yCmaa9koAp4VP7scjVMJylgzagnDy3rEx5YFlk0PO+Pxq8gcItVhFXsa E X-Received: by 2002:a05:600c:4584:b0:426:6551:3174 with SMTP id 5b1f17b1804b1-42abd2458fcmr45245605e9.29.1724329391592; Thu, 22 Aug 2024 05:23:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac517a65dsm22757685e9.34.2024.08.22.05.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 05:23:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Paolo Bonzini , qemu-trivial@nongnu.org, Vladimir Sementsov-Ogievskiy , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Michael Tokarev , qemu-stable@nongnu.org Subject: [PATCH for-9.1?] system/vl.c: Print machine name, not "(null)", for unknown machine types Date: Thu, 22 Aug 2024 13:23:10 +0100 Message-Id: <20240822122310.561885-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In commit 412d294ffdc we tried to improve the error message printed when the machine type is unknown, but we used the wrong variable, resulting in: $ ./build/x86/qemu-system-aarch64 -M bang qemu-system-aarch64: unsupported machine type: "(null)" Use -machine help to list supported machines Use the right variable, so we produce more helpful output: $ ./build/x86/qemu-system-aarch64 -M bang qemu-system-aarch64: unsupported machine type: "bang" Use -machine help to list supported machines Note that we must move the qdict_del() to below the error_setg(), because machine_type points into the value of that qdict entry, and deleting it will make the pointer invalid. Cc: qemu-stable@nongnu.org Fixes: 412d294ffdc ("vl.c: select_machine(): add selected machine type to error message") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- Tagged as for-9.1 because this is a sort-of regression since 9.0 (in 9.0 we didn't try to print the machine type name at all in this error). But it's also very close to release and this is only cosmetics in an error message. The cc-stable is for the case where we don't put it into 9.1 and then backport it to the 9.1 stable branch after release. system/vl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/vl.c b/system/vl.c index 41d53d2456a..01b8b8e77ad 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1679,10 +1679,10 @@ static MachineClass *select_machine(QDict *qdict, Error **errp) if (machine_type) { machine_class = find_machine(machine_type, machines); - qdict_del(qdict, "type"); if (!machine_class) { - error_setg(errp, "unsupported machine type: \"%s\"", optarg); + error_setg(errp, "unsupported machine type: \"%s\"", machine_type); } + qdict_del(qdict, "type"); } else { machine_class = find_default_machine(machines); if (!machine_class) {