From patchwork Tue Jul 16 18:09:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812787 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp436168wrr; Tue, 16 Jul 2024 11:12:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW8TC/SusOxm5tBqlDRjFTxDXaz886oUckLMGEKQc9SEXPhQUYr3O3K53GmIfdz5256h+0IiV01yqcVreEUF+O5 X-Google-Smtp-Source: AGHT+IGj6f86UOoTTZLYBXvBNfcHuQp+zU0EDsbebwphI2k6xfz7lN7bveqDLmfKgxQPlNhybV2+ X-Received: by 2002:a05:620a:1a93:b0:79f:913:8109 with SMTP id af79cd13be357-7a17b690f3fmr375636385a.36.1721153574299; Tue, 16 Jul 2024 11:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153574; cv=none; d=google.com; s=arc-20160816; b=kbAjsYkxcmgs6Y33EuXV7saUjUpC29sVc+sWZ6WmDC4KyUfEPB+XBeIvjnqVUMD/X6 YQv8tmfULx7EwochmLb8l1M3DfouMWIA4KD6sdw/xXHj7OmuaF+9l9bnb4LUhczTqEUv C+X5wM8AAucR31Q16JlZKd5dWqs58QH6eg9uqeAiKNHhQIKRYCn2XLiRRCag/aECPFIC oUB+JcGw2rMIp59QDveZ0gH+lo3WxH8fwHDmsrsQXzK/nlweavGmqrn7IwGnAEJDq9vA JO6uWrIEYozmggoU9nqtyO7HtBbhOa28RI2FumQLMMiSL2lNERH5er7ncteUDU3/H7ar k1XQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VrGZmaUNm2C+uivQuRjRJj4n0srykunZLqWSf7H3M6M=; fh=Fd6aBa0kjgdlhrvDwFUbt95hlpkQS/dn/+AD99bFGaA=; b=LGWJe5fHxMB07wt9nL29cDDngRs4VW+sR8Zi280J6/86gY84dWA3HzWwgM460sBw8o RQI42zqAxL/EXLMIrd4VrJKrff2OQaxI+Pxdfvw8BiMLyZD/ThJ6ZfqhbYHHO9AKVmiS xw12s0DlwWF8L7ebsjEVTe9AJ91Pog14iOYVQ0FviTNoAKEVegg/DMXdv5EgfApkRUC4 /iCvAbxzbA3SfLS78im69YIooFjqX7r21uRxVCsHInhkfDJLwJBxcFUDh8Sy4WWucPp1 /R4G7dojrtpKgI9/GACX0FfBbZ/TiolWrxoQSQbedlx5HrSku433z9CyacJGQbRwxn7N t0gw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UVqfVx5Z; 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-7a160b7be2asi798925185a.47.2024.07.16.11.12.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:12:54 -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=UVqfVx5Z; 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 1sTme5-0004zS-Bc; Tue, 16 Jul 2024 14:11:25 -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 1sTmdZ-0002OD-8U for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:56 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmdX-0001KC-Kk for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:53 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4265b7514fcso51435e9.1 for ; Tue, 16 Jul 2024 11:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153449; x=1721758249; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VrGZmaUNm2C+uivQuRjRJj4n0srykunZLqWSf7H3M6M=; b=UVqfVx5Zg6JYYbRebn4ohEijgCGxs5yB9k2K8PL4rCDqdC3n9p74bB0sKCM9zudST8 viJsVAlHC+Jo8S6ozM4Sc8jfrvdc961X2hzOdY8ppPN/aTFgCLe6DuoVTPY7p4vVh4JK X6Ujdvln6bIlpsmIaYOX1vHCeI3/6Ac310eOgC6zhPYWTcv5231gVwqElDq1WgZNPS7b ZhiNgtldmsQLuKUGjpzpGXV4IzWhGINto6Pfq27S63V79oBbCIsnewx4wBvEvjEJnxYX PIblKPIIMYqHZfwDckRkJNe7dkRUzpHTtXLe3P0Ziw2WcSLQ3beJ2/0MnEqsFdzsbbn/ xpsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153449; x=1721758249; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VrGZmaUNm2C+uivQuRjRJj4n0srykunZLqWSf7H3M6M=; b=eQ6jFrfQtuKoS5gvyJvIx77cqZe1/ZgGBYDw2JuBsXDPXAs4LH759XczivNdTv0gyr QdQoSa8JPLeVTPDP4/WmrrscE8n2RcZGwlAEkj059zxpSbRdcF+fqaKtl8tzIcjKaoHq XxFr8LLvs7vQjh8gMppwh9TrQvzVK4VtgzSXlPF5iZ4/tREYnd0Q8la/PwhZgTnAhFdu NP+swPkcs97ncHM5HtYrJcrpSRKktHKHS0y9iTlsfcy7qbBrHvaWWroblhfUXQBdzope Ngmn9eqWutyJEFzXjW/WWqfh2gLyBFzT/ZzeQGmpqpkbkZHfKIJRUYfwCc0MNQ5WC6KZ Fg6g== X-Gm-Message-State: AOJu0YwQv/ZxHljAFt5ZzUy8s6tE6lsTRMLBXkWnxfIh2O+BIE/Q3q0w yBEihhA9j2VMnmFWYLFiJC8Or5C9xa9LF8XHBH3rNoOSp71d1j6doGijyB946wFRW+gSMsQ4ppE 776TjmA== X-Received: by 2002:a05:600c:310c:b0:426:5cc7:82f with SMTP id 5b1f17b1804b1-427bb8c4cebmr20400235e9.13.1721153449549; Tue, 16 Jul 2024 11:10:49 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dabf15dsm9745401f8f.32.2024.07.16.11.10.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 12/13] vl: fix "type is NULL" in -vga help Date: Tue, 16 Jul 2024 20:09:39 +0200 Message-ID: <20240716180941.40211-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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 autolearn=ham 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 From: Marc-André Lureau Don't pass NULL to module_object_class_by_name(), when the interface is unavailable. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240715114420.2062870-1-marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- system/vl.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/system/vl.c b/system/vl.c index bdd2f6ecf6..9e8f16f155 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1000,9 +1000,16 @@ static bool vga_interface_available(VGAInterfaceType t) const VGAInterfaceInfo *ti = &vga_interfaces[t]; assert(t < VGA_TYPE_MAX); - return !ti->class_names[0] || - module_object_class_by_name(ti->class_names[0]) || - module_object_class_by_name(ti->class_names[1]); + + if (!ti->class_names[0] || module_object_class_by_name(ti->class_names[0])) { + return true; + } + + if (ti->class_names[1] && module_object_class_by_name(ti->class_names[1])) { + return true; + } + + return false; } static const char *