From nobody Thu Nov 14 17:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708441737; cv=none; d=zohomail.com; s=zohoarc; b=aUR8VZ1w+mQFmhzfJmAD03porF+Qb/5MdUiVoR7zgT82Q1vZ4orsPb5w3ny2vbvsa674T8StO3xhY5GVQV57CgR+H12+Fc5Sa+TIOe/2oH5IdoI8MpV8ompCmQaIOBhbxInw/y601BU7ZdLYilUJB5bOIwCamryW21WBZeFAlr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708441737; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DoQEZxzYJVlRUc/fG+BPKnGGJWFI0zTUpD/ARH6eLL4=; b=HxeWOdPG+jmJ1+VxXtwBER2yNDOFMswNMECguD1q6MW7iPQ4FjYpRR7kxjfZO8wyyNTlm71it94JCcAppqBNLIO5cpjmmIRoyUoQUTGEc0FNOd4bOyXbGbicMcjgWzuIlwwU8smRa6T/vdJI/E1bO/DvA5Ew/4mO9u1bTSeRJr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708441737341311.782626027515; Tue, 20 Feb 2024 07:08:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcRjk-0004LK-KN; Tue, 20 Feb 2024 10:08:48 -0500 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 1rcRjj-0004KX-5r for qemu-devel@nongnu.org; Tue, 20 Feb 2024 10:08:47 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcRjh-0003mS-Iy for qemu-devel@nongnu.org; Tue, 20 Feb 2024 10:08:46 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-412698ac6f9so10493695e9.0 for ; Tue, 20 Feb 2024 07:08:45 -0800 (PST) Received: from m1x-phil.lan (mek33-h02-176-184-23-7.dsl.sta.abo.bbox.fr. [176.184.23.7]) by smtp.gmail.com with ESMTPSA id s10-20020a05600c044a00b004122fbf9253sm14710257wmb.39.2024.02.20.07.08.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 20 Feb 2024 07:08:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708441723; x=1709046523; 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=DoQEZxzYJVlRUc/fG+BPKnGGJWFI0zTUpD/ARH6eLL4=; b=KP0m2D4Ed2bg28mqz31xflJtUHaMQ5c6BRiduFN3AP8h+K4g3w+GKRvfpIVcEZkEuk k4cAw+lYv4Zvrhe44+BQk+/hiv/2BwODXh/6TyE0wh6Xx7+Ba2O+Vb0c4eMGWCTRbrQa cw9jKW+JhoCo7PQ6HUFvX9kVodkQu9p9M3Vmssw7LXOQQZzLrFY4zqGDVistZfirk25y JfO1SngW8E9F76ySZROqgAHn5ki6hetr0q/5Rkew1WTjAROwTtyc4TpQgEvwrIq9eiyP c0VKg5UbVr5fbN+CRglqRCUU9ZkDVufBq6QWTumVewRxrma3KyPUUsw0kwKEFAzcq7xg hmGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708441723; x=1709046523; 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=DoQEZxzYJVlRUc/fG+BPKnGGJWFI0zTUpD/ARH6eLL4=; b=bKGCgADiOqLO2XJDAV74r71ibSShljbWTifVMXCC8V5EJ3eagmtb7gpGd8RazvfTWJ EePn0IfPFLqiQOESVmRy1daNIGrP7uTsF+PMU9HJ3BxELtMej2nCiQt4MAXzuBcmiZ5n 5JWFQa+rXXEsvhYWhfgOVFAZjFRKo+S1RY3AiR4x27X8tbIyNEqJF0GSUWPQWhOXJS9p S70u0fVj5DGMeld8vThX0exHJeC/CktN/C9kYEG7L/+QEzKjzZBBIRuyRkjnPtZpZ5vG YVq37HyhGGfgHR+bepvsaJ9V3+kgCkdbyygKZUm5bieJYpA78/xOOM/UA4jcBHwZ8rdW /c/A== X-Gm-Message-State: AOJu0Yw1t8eubmeEVZYkX85bcw4FgSXKUZ/M9SzHDedPM52JVCsmn1WX /OA8ImrOdfkAylmZypzjlUm6/z7m86wpZaLAlzihntv0A88l3O09EWZgScEJXduY8K15kinkAdN V X-Google-Smtp-Source: AGHT+IFRgFHA7ibg2iRgyjF2izbBJs5D33IFOcLFWt4tqEfyIBON1t7f/Mq3qYZjvAa+TLMTqVKcBA== X-Received: by 2002:a05:600c:3513:b0:412:5f5f:1729 with SMTP id h19-20020a05600c351300b004125f5f1729mr6633567wmq.20.1708441722947; Tue, 20 Feb 2024 07:08:42 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Markus Armbruster , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Christian Borntraeger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/4] hw/nmi: Use object_child_foreach_recursive() in nmi_children() Date: Tue, 20 Feb 2024 16:08:30 +0100 Message-ID: <20240220150833.13674-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240220150833.13674-1-philmd@linaro.org> References: <20240220150833.13674-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708441739748100003 Replace object_child_foreach() and recursion by a single object_child_foreach_recursive() call. Propagate the returned value so callers can check it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/core/nmi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/core/nmi.c b/hw/core/nmi.c index a7bce8a04a..f5220111c1 100644 --- a/hw/core/nmi.c +++ b/hw/core/nmi.c @@ -31,8 +31,6 @@ struct do_nmi_s { bool handled; }; =20 -static void nmi_children(Object *o, struct do_nmi_s *ns); - static int do_nmi(Object *o, void *opaque) { struct do_nmi_s *ns =3D opaque; @@ -47,14 +45,13 @@ static int do_nmi(Object *o, void *opaque) return -1; } } - nmi_children(o, ns); =20 return 0; } =20 -static void nmi_children(Object *o, struct do_nmi_s *ns) +static int nmi_children(Object *o, struct do_nmi_s *ns) { - object_child_foreach(o, do_nmi, ns); + return object_child_foreach_recursive(o, do_nmi, ns); } =20 void nmi_monitor_handle(int cpu_index, Error **errp) @@ -65,10 +62,9 @@ void nmi_monitor_handle(int cpu_index, Error **errp) .handled =3D false }; =20 - nmi_children(object_get_root(), &ns); - if (ns.handled) { + if (nmi_children(object_get_root(), &ns)) { error_propagate(errp, ns.err); - } else { + } else if (!ns.handled) { error_setg(errp, "machine does not provide NMIs"); } } --=20 2.41.0