Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5617225rwb; Wed, 9 Aug 2023 06:58:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExfA0ElylbH8gWypa6y0hx+3slDgfmuVuBHWsTA9LoiB8ViUYBP4EPVytxRVMrWnfQy1Uh X-Received: by 2002:a05:6808:14cd:b0:3a3:e638:78d2 with SMTP id f13-20020a05680814cd00b003a3e63878d2mr3261869oiw.12.1691589494544; Wed, 09 Aug 2023 06:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691589494; cv=none; d=google.com; s=arc-20160816; b=ZggHiOJ3oLl18DbQxEzua4got6klbZqDQEovRvXQvGpmw6gr6exp6eqPgxhNkpUJ+p mBL33CEPD8uTyzMWv3HnM2E85vTuwY6Z+ugNpU+UiOuT91CWUBOp9s1NBQOsFlwf8IdU 5afCbarQ/6SLZ1lrZmsee6QYPSVZ7/suZ6dQPUcIknzNxYp5VWwBAaf8b4kTanPqUCKg Qhj2WWxNHFfYHUKsLtsqOTiGvt6Zc7WG9rgzrPhiEQ0TTGWIV/7pTp/IH64IBE7ymiYS uQRN6ykg/q4Sl7UxGSHh9sBQ32YYt5ZnsGta26/BXO3dTHHQRK75w7cpYT10e4er19re PwcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VR4cnx2N+04eGgRYyGyebcaIM9EByQCnUdS4tT1vSe0=; fh=OtJVFpZ5Y8/ND7g8QcUIbRSFhG4LznwcYYtG4zWKevM=; b=mqWNiu0Ddw8AJ9XNzI7awmaTaaFDo5NaUIFu+ESNHc0ZEZRVTd6cEQj1oqZLItUbO3 TMAAyGy0Fo6zyTECDn6DBdSxdCNUI97XH0m3sPTEoRTRebh96n0Q4/W0O/Rm1zuQlRz5 CIl/XRhBkmNeCyhIGIfdHH5p5TCvYCGcH5oXPtS69gouyotEE6XCq9C4C5xg9B4fyLHT +VfLBO7fVRO/m/peooh91S4QaV2ybC0mrTakh6Bb3LYVf5citO9y0DKdpF3EW0xR2IVD 7X1C04fZkDMVFt3MGey6FnlrRftt3fLQhmHM7KNQyG2XJj1/ndpQbOdn1750UgXFwApz JTuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RC4g+mdP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch5-20020a17090af40500b00263542b45a4si1490468pjb.43.2023.08.09.06.57.32; Wed, 09 Aug 2023 06:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RC4g+mdP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233530AbjHINa0 (ORCPT + 99 others); Wed, 9 Aug 2023 09:30:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233062AbjHIN3p (ORCPT ); Wed, 9 Aug 2023 09:29:45 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CECB3582; Wed, 9 Aug 2023 06:28:59 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPA id E6C1940007; Wed, 9 Aug 2023 13:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691587735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VR4cnx2N+04eGgRYyGyebcaIM9EByQCnUdS4tT1vSe0=; b=RC4g+mdPwKb6I9+NrID8ap1PXtRoLXjK51YOO/bY38etqbMYcMXZEHtKJ4FzktDYNeuufD 9ZPui4xoieG+KeySFTgKvp1IP3jRzjChKDqeLOPDy6fwDDI3CSTbK1Jzz3wVz0WgXW8J5Q 9E59ipZqEcmB4aykrvOeNK+C+hfJIPUt3SxFbeOHIWzVj3jCgyZK7ryVYXEOQ3+FKXRV8k wMymgXZRYqJGY0YV0Li7FC2ZfOvHM22p7rDQTIxEwHZOghlXjnB82FxCU+AmI23F6qVFoZ U47XYUD1jeKssUCVUIavxK1k8G34L2UqMBHsHLfIDXKOENRT8bAb5Nz4jyt9xQ== From: Herve Codina To: Herve Codina , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Linus Walleij , Qiang Zhao , Li Yang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Christophe Leroy , Randy Dunlap Cc: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, Thomas Petazzoni Subject: [PATCH v3 23/28] mfd: core: Ensure disabled devices are skiped without aborting Date: Wed, 9 Aug 2023 15:27:50 +0200 Message-ID: <20230809132757.2470544-24-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230809132757.2470544-1-herve.codina@bootlin.com> References: <20230809132757.2470544-1-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The loop searching for a matching device based on its compatible string is aborted when a matching disabled device is found. This abort prevents to add devices as soon as one disabled device is found. Continue searching for an other device instead of aborting on the first disabled one fixes the issue. Fixes: 22380b65dc70 ("mfd: mfd-core: Ensure disabled devices are ignored without error") Signed-off-by: Herve Codina Reviewed-by: Christophe Leroy --- drivers/mfd/mfd-core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 0ed7c0d7784e..2b85509a90fc 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -146,6 +146,7 @@ static int mfd_add_device(struct device *parent, int id, struct platform_device *pdev; struct device_node *np = NULL; struct mfd_of_node_entry *of_entry, *tmp; + bool disabled = false; int ret = -ENOMEM; int platform_id; int r; @@ -183,11 +184,10 @@ static int mfd_add_device(struct device *parent, int id, if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { for_each_child_of_node(parent->of_node, np) { if (of_device_is_compatible(np, cell->of_compatible)) { - /* Ignore 'disabled' devices error free */ + /* Skip 'disabled' devices */ if (!of_device_is_available(np)) { - of_node_put(np); - ret = 0; - goto fail_alias; + disabled = true; + continue; } ret = mfd_match_of_node_to_dev(pdev, np, cell); @@ -197,10 +197,17 @@ static int mfd_add_device(struct device *parent, int id, if (ret) goto fail_alias; - break; + goto match; } } + if (disabled) { + /* Ignore 'disabled' devices error free */ + ret = 0; + goto fail_alias; + } + +match: if (!pdev->dev.of_node) pr_warn("%s: Failed to locate of_node [id: %d]\n", cell->name, platform_id); -- 2.41.0