Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3098755rdb; Wed, 13 Sep 2023 01:46:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiV0Ln/j4yg0wWY/QqDcNFtBrS6F8Gh/wDiVKLb4bAuoZ1LHZVNO76PtmNLXAVpxbSpeIk X-Received: by 2002:a05:6a20:3d04:b0:132:c07d:9dd2 with SMTP id y4-20020a056a203d0400b00132c07d9dd2mr2272021pzi.39.1694594785454; Wed, 13 Sep 2023 01:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694594785; cv=none; d=google.com; s=arc-20160816; b=AJR9wmJyrcek8Fru2/3xXxhSlp2LxsSXAQV2VxTxnXvY+oTfac0fR2rHtZUXG16aP4 a0/P1vouPIHImQyvfkknBunIlfwGzZ/0SAptKvTiyXEN2XjuW7/hU8ZKC7kt4er6b92/ H1sXeG3QvrinHqRQDth5ZdImbF3dzCfpqtaR6/ZrPKoUPnYNuAE9scFGXLPxEj+zLug1 RZrj2ZoOWM3h6kbXMfMUtEwFkmgZWbpG+iNk0SgsW5WrVJ/NzWdFuHIK0F6gWmamBr97 wOVedvfj90cA90y8ZCEupOy0jWnqoRBFzfnl/2Ot1/NlXNpjSOnjAnzqv4px08jqxSwE RFxg== 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=Jw3Gh+MHnc0e4iOVQpQST5zM4wYamee+SjAxSspcoIs=; fh=5rCQDomVZxLXb7yR2oN4iSS3zxUnzGJP2HoQaRzhQu0=; b=MCruK58ulXoj6LWJVdWmgDMiQ0pS9j2aRu41JeD1E3zt0cA9m/LfuxbA+3l8kTPvxX m5hQ3u/CCg0j/fhdV8BgzR8QwTknrkKNnfv54kp2n5pL3kEcTherAl8us/SV+mHv6/qi I20BLmWQY5wKhT3LxrF2BUs4ZKHJAwr/9sx3vorr801Qw/xwz2ljRH8GGpaINK+jMaTR lS78Ntzo15VgcRCvuchdzVKwmdgVPDfPkEoGeGvCNMAKYqARhE4MVAUyfUueanWRghlN I/R8/uOHoC+wwcVobo5WvOlBTB4cwEOLf3t5+31pIpZiN7Wp23F1V1Do2wzOaROJ4i9O ccgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hPRQvqJM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i18-20020a17090ad35200b0026faad888a4si1109342pjx.6.2023.09.13.01.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hPRQvqJM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0DF99857E54B; Tue, 12 Sep 2023 03:16:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234098AbjILKPt (ORCPT + 99 others); Tue, 12 Sep 2023 06:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233998AbjILKP2 (ORCPT ); Tue, 12 Sep 2023 06:15:28 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C152113; Tue, 12 Sep 2023 03:14:57 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPA id 9CB491C0002; Tue, 12 Sep 2023 10:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1694513696; 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=Jw3Gh+MHnc0e4iOVQpQST5zM4wYamee+SjAxSspcoIs=; b=hPRQvqJM9L6DktTMjvNWTFU6R2+Y+3g4v1IatnU19aiZItQLjnO31cVjKwyLtriAT+kiey knO8yYFkYjf4oa+C4PFjR0Zo5xgPDFOJ8po6+E94BPHQKVaMLcF1Ge4uBWt4jMARZUbhrE JDf/Sl5TCy6I4rNTGK7X+T6z7Cpi/cMlmflIFF9xjhA37XYZJBsRLkWNd9m7e9JnvarShy J5VZfWJbT5CmONM1eqvzP8X8DX0cNx8HqL4Yj1gvtzYFH1XJ9tsV1NXji5BE3PZ78Dxe8Z F5MSuwpkKxmVTNUEA71V7QRSHQ8dREVscyQ0vTMFBdS39WFSB/NsB3ld5vbndg== 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, Simon Horman , Christophe JAILLET , Thomas Petazzoni Subject: [PATCH v5 26/31] mfd: core: Ensure disabled devices are skipped without aborting Date: Tue, 12 Sep 2023 12:14:50 +0200 Message-ID: <20230912101450.225838-1-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230912081527.208499-1-herve.codina@bootlin.com> References: <20230912081527.208499-1-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 03:16:00 -0700 (PDT) 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 Signed-off-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