From patchwork Wed Jul 5 12:30:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 699255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB2D9EB64DA for ; Wed, 5 Jul 2023 14:40:57 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 43C2E84D; Wed, 5 Jul 2023 16:40:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 43C2E84D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568055; bh=CMTp5PjcrdGB1YgiokfJfbw4f+gtghxZ4pFtHuNvMII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UWxcdus9lnDdr0gZz2WD5TJrzl4GWnQzKqjtO9B91wvlDTJXxPfMIdAWqIcFl5yxi 2pUEiTnNjD9AEGZQPxlFtQsokMe/WcKsH6a+l79mswnr/mHixKEP9ZdJ6nq0kiaCln Lj0+ong9IfZIAzrk3DPlNbq4q157R4g1/VvFAuWQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 197AFF80578; Wed, 5 Jul 2023 16:39:13 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A5CBAF80568; Wed, 5 Jul 2023 16:39:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0E61AF80548; Wed, 5 Jul 2023 14:33:23 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8ACE9F800E4 for ; Wed, 5 Jul 2023 14:33:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8ACE9F800E4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=L0Dgj5tm Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 200B061553; Wed, 5 Jul 2023 12:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AA8C433CA; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=CMTp5PjcrdGB1YgiokfJfbw4f+gtghxZ4pFtHuNvMII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0Dgj5tmXqHoyyYmXI4/RmaTjUN4wyzU/xOCwCBvvGoE39qgLwvw+J1h106R3nsDs Sef6fGSlgU22yQq+WQMbyo9fpKjJiBIMrTbYCxBXWou4lKdL5kFZ6b4IBLSP0/T2A3 uqoVQUKZd6PlWEPqZE+n6mw0SJbDbCbssW5sgI3z9/5jwEDHeQIto4znL7GBKASZgW FAhE0hSZ0ngFp3V44O8SMuKy+rHr743Uz5Ci4GeaIhkMbTCXU3Nl/w0MvM7SRsFbST KxcuBFBhR9Lfvz0mvlhZGOBNNNv6ojq8fZzldhjMt9Y1u1t89wnokWr25IGUghR+7M 21ZSaShu23tpg== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-000848-0Q; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Rander Wang Subject: [PATCH 1/8] soundwire: fix enumeration completion Date: Wed, 5 Jul 2023 14:30:11 +0200 Message-Id: <20230705123018.30903-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: DJXTWZVQ5WC24CORVYW7Q45A46JJ72CO X-Message-ID-Hash: DJXTWZVQ5WC24CORVYW7Q45A46JJ72CO X-Mailman-Approved-At: Wed, 05 Jul 2023 14:39:06 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The soundwire subsystem uses two completion structures that allow drivers to wait for soundwire device to become enumerated on the bus and initialised by their drivers, respectively. The code implementing the signalling is currently broken as it does not signal all current and future waiters and also uses the wrong reinitialisation function, which can potentially lead to memory corruption if there are still waiters on the queue. Not signalling future waiters specifically breaks sound card probe deferrals as codec drivers can not tell that the soundwire device is already attached when being reprobed. Some codec runtime PM implementations suffer from similar problems as waiting for enumeration during resume can also timeout despite the device already having been enumerated. Fixes: fb9469e54fa7 ("soundwire: bus: fix race condition with enumeration_complete signaling") Fixes: a90def068127 ("soundwire: bus: fix race condition with initialization_complete signaling") Cc: stable@vger.kernel.org # 5.7 Cc: Pierre-Louis Bossart Cc: Rander Wang Signed-off-by: Johan Hovold --- drivers/soundwire/bus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 1ea6a64f8c4a..66e5dba919fa 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -908,8 +908,8 @@ static void sdw_modify_slave_status(struct sdw_slave *slave, "initializing enumeration and init completion for Slave %d\n", slave->dev_num); - init_completion(&slave->enumeration_complete); - init_completion(&slave->initialization_complete); + reinit_completion(&slave->enumeration_complete); + reinit_completion(&slave->initialization_complete); } else if ((status == SDW_SLAVE_ATTACHED) && (slave->status == SDW_SLAVE_UNATTACHED)) { @@ -917,7 +917,7 @@ static void sdw_modify_slave_status(struct sdw_slave *slave, "signaling enumeration completion for Slave %d\n", slave->dev_num); - complete(&slave->enumeration_complete); + complete_all(&slave->enumeration_complete); } slave->status = status; mutex_unlock(&bus->bus_lock); @@ -1941,7 +1941,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus, "signaling initialization completion for Slave %d\n", slave->dev_num); - complete(&slave->initialization_complete); + complete_all(&slave->initialization_complete); /* * If the manager became pm_runtime active, the peripherals will be From patchwork Wed Jul 5 12:30:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 700087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75959EB64DA for ; Wed, 5 Jul 2023 14:40:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 021C0844; Wed, 5 Jul 2023 16:40:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 021C0844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568050; bh=qDcBaomIkhoRa3+mwqsvw9eva/EwpZwx+a08ZDhuyHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=YfKrrLkl1QLuyu2E0r6bRRMxCyRK2D88ICkYDvr73k/r7RfttY++w4rwzdNf8pvgS ocJCtqtwrICfGwOXBmKhu3b2/qqEJNe1LnfVE9ZyzLypyDAzrYaVtUVU3GO2L1vv1g 8RKNxybN+rW/m3NlKeRkt+a5Iw5vjk/FgoFDFIL0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 32E95F8055B; Wed, 5 Jul 2023 16:39:11 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 9C07BF80132; Wed, 5 Jul 2023 16:39:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 26F37F80548; Wed, 5 Jul 2023 14:33:19 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A9420F80125 for ; Wed, 5 Jul 2023 14:33:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A9420F80125 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=F1G8j3jK Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22F886155A; Wed, 5 Jul 2023 12:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CA00C433C7; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=qDcBaomIkhoRa3+mwqsvw9eva/EwpZwx+a08ZDhuyHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1G8j3jK0849KbqKJS5dUNA/FOp0LYg/sWx4IR2s8SU71hGnMLB1Dc1xzHbGtdeT+ GNQ5oMXTaZa0UZkoNokxGgfvOOFvsMLL2Fw+brlcIRK5xoznygPEeg7EsMnvr/sl0K ucYgrqPEhgRyyeouQsH9g6gLkWj7uAzvIW2VZ45Hmg5DgjsjsiS/1welAEpXqwvR1g yhGDrWDR9fwgklawYzDZxd3tn4Nr/oDM9QfFba9etng7A2nPY46f/QPIjTel699iTa mkNAufmHMQ2EXRfhKSLdtlexwHK+zEEO14ZfuWGmaSo5JHGdX0A84mm+jiZyKyk+0c tIpItOK1VtFpA== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-00084A-0k; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 2/8] ASoC: qdsp6: audioreach: fix topology probe deferral Date: Wed, 5 Jul 2023 14:30:12 +0200 Message-Id: <20230705123018.30903-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: QVCW5O3TRXFLKAT5X7MABCQRH4SIA4HF X-Message-ID-Hash: QVCW5O3TRXFLKAT5X7MABCQRH4SIA4HF X-Mailman-Approved-At: Wed, 05 Jul 2023 14:39:05 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Propagate errors when failing to load the topology component so that probe deferrals can be handled. Fixes: 36ad9bf1d93d ("ASoC: qdsp6: audioreach: add topology support") Cc: stable@vger.kernel.org # 5.17 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold --- sound/soc/qcom/qdsp6/topology.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c index cccc59b570b9..130b22a34fb3 100644 --- a/sound/soc/qcom/qdsp6/topology.c +++ b/sound/soc/qcom/qdsp6/topology.c @@ -1277,8 +1277,8 @@ int audioreach_tplg_init(struct snd_soc_component *component) ret = snd_soc_tplg_component_load(component, &audioreach_tplg_ops, fw); if (ret < 0) { - dev_err(dev, "tplg component load failed%d\n", ret); - ret = -EINVAL; + if (ret != -EPROBE_DEFER) + dev_err(dev, "tplg component load failed: %d\n", ret); } release_firmware(fw); From patchwork Wed Jul 5 12:30:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 700086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27D46EB64DA for ; Wed, 5 Jul 2023 14:42:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 34D0D83A; Wed, 5 Jul 2023 16:42:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 34D0D83A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568177; bh=wvD6bbrOokxfZPO0DaokGurW5X0rMNd0E3gL+SAwNDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=sI9obzE1Af8QZpZOFZLP6GL1xBdtXhN8IvHIX6PkQJGAsRBTynqZYmMBEWIWMXKRs 4sQR3gssg/wQePhRB64xRVNYSOky4VGdpoAWtBBKBQorPOEOT6rBVe6OBgPyG/iN7B MJ1elB7eUO8hp6Rujw3UVnama2SBFp+hXV9F7Pr8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9114CF80132; Wed, 5 Jul 2023 16:41:40 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id DA1FAF8025F; Wed, 5 Jul 2023 16:41:39 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9C8AAF80551; Wed, 5 Jul 2023 14:33:24 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A3B46F80124 for ; Wed, 5 Jul 2023 14:33:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A3B46F80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=OrzrAs3K Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21B3B614FB; Wed, 5 Jul 2023 12:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8159FC433C8; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=wvD6bbrOokxfZPO0DaokGurW5X0rMNd0E3gL+SAwNDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OrzrAs3Kf3NwkB6zPJMgq32SprJp3/GoftKi8agEkCoOfEhjQKP0Av4nA7LIClKjp 71dxk/K3PUdH7D6lRX+QH6zwbbJpjrQP170yTK+y/4bj9wKaeLuX7pMVRjhRiisRSc SLkCpvjzO5D4lTIJ46WiwdD/ZYU3uC+tv1hZTf9o5/1MNqlDgciP897QSq3pPMwfK0 OResP1n/XRy2Q5dSSgR9wUwsKPPUpAr8BF2fUlRqHedDhpPQMQxl8jviYASKcv0sY8 JuzseHo230TbjSJGImzoAQSKFvumw1kwW2MLo7Vu5uKTi43q+QvZ6WpTIY2+0y1WGY D6uGCn/oSzVSg== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-00084C-10; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 3/8] ASoC: codecs: wcd938x: fix missing clsh ctrl error handling Date: Wed, 5 Jul 2023 14:30:13 +0200 Message-Id: <20230705123018.30903-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 5XVQUVG2FDE6KGC3ZSWVIDCSB7OXDWE3 X-Message-ID-Hash: 5XVQUVG2FDE6KGC3ZSWVIDCSB7OXDWE3 X-Mailman-Approved-At: Wed, 05 Jul 2023 14:41:37 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allocation of the clash control structure may fail so add the missing error handling to avoid dereferencing an error pointer. Fixes: 8d78602aa87a ("ASoC: codecs: wcd938x: add basic driver") Cc: stable@vger.kernel.org # 5.14 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd938x.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index faa15a5ed2c8..2e342398d027 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3106,6 +3106,10 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component) WCD938X_ID_MASK); wcd938x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD938X); + if (IS_ERR(wcd938x->clsh_info)) { + pm_runtime_put(dev); + return PTR_ERR(wcd938x->clsh_info); + } wcd938x_io_init(wcd938x); /* Set all interrupts as edge triggered */ From patchwork Wed Jul 5 12:30:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 699253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E33FCC001B0 for ; Wed, 5 Jul 2023 14:43:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B94F1868; Wed, 5 Jul 2023 16:42:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B94F1868 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568227; bh=fkeH/trnUCotq/eMq+tRenmiWPEZTSYWlpllerwpCEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=m85ylP+oLwpogcfa2mkdnLOYgDUnNFESIWKmUR/goz6cBAbbeIayWO8vXWrBhrDPj bGVA2JkMxnpqhlCGVowi3lH1zn2FSH0Ey/4+DywFL4TnKaJxPJJ9YJy0wFlw5730ly 9XdA+cQDiHT0OAri5LB+OKVQbPuW7fL9X34lhdME= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B3F73F80578; Wed, 5 Jul 2023 16:41:47 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1FF9DF80578; Wed, 5 Jul 2023 16:41:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EE43FF80125; Wed, 5 Jul 2023 14:33:29 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 767EEF80272 for ; Wed, 5 Jul 2023 14:33:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 767EEF80272 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=kTdvDCFY Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E63D61561; Wed, 5 Jul 2023 12:33:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95922C433CC; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=fkeH/trnUCotq/eMq+tRenmiWPEZTSYWlpllerwpCEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTdvDCFYKw21sRmjWal+eILYeelHqmrpRknWGNYfzgQmV1yZQmrokWC0wEtJcDESs wFg66S6c0Atvwd7L8gFtxdlPIczCGJvZLlLsAjtkMkAFcBdB5FLr8PF+2REXKMsTjk M0xAdHFFCSJHoKlz1WqcnAcC74Q48yUA6+ZuzKHwj/doFP0RfgPOfcJHfYlRIbYfG3 hBA/8lFQxUs0RNTbR/kxPGm7bMq9bwCIcONGLh14Tnp87VlAXk4/+cfkeijgJvnVB9 yndfN2YnB3wN/xJ6yGtdmx7keRwlGNGDz4EMKP+BeHs3ezGKoXAbaIdt/wfNIEn1Js ITeLbLk5pf57g== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-00084E-1F; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 4/8] ASoC: codecs: wcd938x: fix resource leaks on component remove Date: Wed, 5 Jul 2023 14:30:14 +0200 Message-Id: <20230705123018.30903-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: L4EPEATUUVNZNOUIIW4BJFPMNL6UJL4Y X-Message-ID-Hash: L4EPEATUUVNZNOUIIW4BJFPMNL6UJL4Y X-Mailman-Approved-At: Wed, 05 Jul 2023 14:41:37 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Make sure to release allocated resources on component probe failure and on remove. This is specifically needed to allow probe deferrals of the sound card which otherwise fails when reprobing the codec component: snd-sc8280xp sound: ASoC: failed to instantiate card -517 genirq: Flags mismatch irq 289. 00002001 (HPHR PDM WD INT) vs. 00002001 (HPHR PDM WD INT) wcd938x_codec audio-codec: Failed to request HPHR WD interrupt (-16) genirq: Flags mismatch irq 290. 00002001 (HPHL PDM WD INT) vs. 00002001 (HPHL PDM WD INT) wcd938x_codec audio-codec: Failed to request HPHL WD interrupt (-16) genirq: Flags mismatch irq 291. 00002001 (AUX PDM WD INT) vs. 00002001 (AUX PDM WD INT) wcd938x_codec audio-codec: Failed to request Aux WD interrupt (-16) genirq: Flags mismatch irq 292. 00002001 (mbhc sw intr) vs. 00002001 (mbhc sw intr) wcd938x_codec audio-codec: Failed to request mbhc interrupts -16 Fixes: 8d78602aa87a ("ASoC: codecs: wcd938x: add basic driver") Cc: stable@vger.kernel.org # 5.14 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold Reviewed-by: Srinivas Kandagatla --- sound/soc/codecs/wcd938x.c | 55 +++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 2e342398d027..be38cad5f354 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2636,6 +2636,14 @@ static int wcd938x_mbhc_init(struct snd_soc_component *component) return 0; } + +static void wcd938x_mbhc_deinit(struct snd_soc_component *component) +{ + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); + + wcd_mbhc_deinit(wcd938x->wcd_mbhc); +} + /* END MBHC */ static const struct snd_kcontrol_new wcd938x_snd_controls[] = { @@ -3131,20 +3139,26 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component) ret = request_threaded_irq(wcd938x->hphr_pdm_wd_int, NULL, wcd938x_wd_handle_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "HPHR PDM WD INT", wcd938x); - if (ret) + if (ret) { dev_err(dev, "Failed to request HPHR WD interrupt (%d)\n", ret); + goto err_free_clsh_ctrl; + } ret = request_threaded_irq(wcd938x->hphl_pdm_wd_int, NULL, wcd938x_wd_handle_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "HPHL PDM WD INT", wcd938x); - if (ret) + if (ret) { dev_err(dev, "Failed to request HPHL WD interrupt (%d)\n", ret); + goto err_free_hphr_pdm_wd_int; + } ret = request_threaded_irq(wcd938x->aux_pdm_wd_int, NULL, wcd938x_wd_handle_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "AUX PDM WD INT", wcd938x); - if (ret) + if (ret) { dev_err(dev, "Failed to request Aux WD interrupt (%d)\n", ret); + goto err_free_hphl_pdm_wd_int; + } /* Disable watchdog interrupt for HPH and AUX */ disable_irq_nosync(wcd938x->hphr_pdm_wd_int); @@ -3159,7 +3173,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component) dev_err(component->dev, "%s: Failed to add snd ctrls for variant: %d\n", __func__, wcd938x->variant); - goto err; + goto err_free_aux_pdm_wd_int; } break; case WCD9385: @@ -3169,7 +3183,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component) dev_err(component->dev, "%s: Failed to add snd ctrls for variant: %d\n", __func__, wcd938x->variant); - goto err; + goto err_free_aux_pdm_wd_int; } break; default: @@ -3177,12 +3191,38 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component) } ret = wcd938x_mbhc_init(component); - if (ret) + if (ret) { dev_err(component->dev, "mbhc initialization failed\n"); -err: + goto err_free_aux_pdm_wd_int; + } + + return 0; + +err_free_aux_pdm_wd_int: + free_irq(wcd938x->aux_pdm_wd_int, wcd938x); +err_free_hphl_pdm_wd_int: + free_irq(wcd938x->hphl_pdm_wd_int, wcd938x); +err_free_hphr_pdm_wd_int: + free_irq(wcd938x->hphr_pdm_wd_int, wcd938x); +err_free_clsh_ctrl: + wcd_clsh_ctrl_free(wcd938x->clsh_info); + return ret; } +static void wcd938x_soc_codec_remove(struct snd_soc_component *component) +{ + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); + + wcd938x_mbhc_deinit(component); + + free_irq(wcd938x->aux_pdm_wd_int, wcd938x); + free_irq(wcd938x->hphl_pdm_wd_int, wcd938x); + free_irq(wcd938x->hphr_pdm_wd_int, wcd938x); + + wcd_clsh_ctrl_free(wcd938x->clsh_info); +} + static int wcd938x_codec_set_jack(struct snd_soc_component *comp, struct snd_soc_jack *jack, void *data) { @@ -3199,6 +3239,7 @@ static int wcd938x_codec_set_jack(struct snd_soc_component *comp, static const struct snd_soc_component_driver soc_codec_dev_wcd938x = { .name = "wcd938x_codec", .probe = wcd938x_soc_codec_probe, + .remove = wcd938x_soc_codec_remove, .controls = wcd938x_snd_controls, .num_controls = ARRAY_SIZE(wcd938x_snd_controls), .dapm_widgets = wcd938x_dapm_widgets, From patchwork Wed Jul 5 12:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 700083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC9CAC001DE for ; Wed, 5 Jul 2023 14:44:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A7FDC84B; Wed, 5 Jul 2023 16:43:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A7FDC84B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568276; bh=bdDLZCglkynD91RnEE0P/JUB/wG+iACKpfOzXwB+k8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DLByY0Cf4DLQuNlvWkWxwQmEBAEtAdkxTghurSEodXE2vymg3M2zQ1egKcoArwHl8 ssn9oMEqxPkOs5/APiFWrKCuQF8MftEbcBy6TleKzbFLJJvKNyOjWYKpQIkhNogG0z PXvtfxqAmJgDntC3i22m07wYwmU1ONLI1Sf0uvyo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3FA4AF805BD; Wed, 5 Jul 2023 16:41:56 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A6D92F805BD; Wed, 5 Jul 2023 16:41:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 58396F80125; Wed, 5 Jul 2023 14:35:15 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4DE1AF80132 for ; Wed, 5 Jul 2023 14:33:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4DE1AF80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=NvZ0l2dY Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D7D4261582; Wed, 5 Jul 2023 12:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A0BAC433CD; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=bdDLZCglkynD91RnEE0P/JUB/wG+iACKpfOzXwB+k8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NvZ0l2dYbJQL3lj93Xn3I8gdvEuHf+3CGUMkAUgBGfLBeRyaOtnuNVkeKKv9DvaIc j+brMH46O0LAES+l7K3gpLdqox4aDDo4y1DifGhEJCMENB2X6hhPv6qQE2rc9XCcEP 9AtNEn7q6L1rzIciuH8Mk9ucxXUmVfjved2Frd6hgxVw+z3NXuL+Pdb9/VT6ygpbig hlBlW+6cu+Yl8fijCgNNbXarVmWYStGzlo96dixoMP4LtohVD/1coVAAeJhHEVtLkU ycGkzcabxy+3WKmfISCfZZR9ztCBEt8hf34WZeM488kXWw3FRsMH6nnfOqg1yENlgZ SqFS0sRMTDB9g== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-00084G-1V; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 5/8] ASoC: codecs: wcd934x: fix resource leaks on component remove Date: Wed, 5 Jul 2023 14:30:15 +0200 Message-Id: <20230705123018.30903-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: VGHZJRPJXP534F2UTW73RUNOJN5YUXHJ X-Message-ID-Hash: VGHZJRPJXP534F2UTW73RUNOJN5YUXHJ X-Mailman-Approved-At: Wed, 05 Jul 2023 14:41:38 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: <> List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Make sure to release allocated MBHC resources also on component remove. This is specifically needed to allow probe deferrals of the sound card which otherwise fails when reprobing the codec component. Fixes: 9fb9b1690f0b ("ASoC: codecs: wcd934x: add mbhc support") Cc: stable@vger.kernel.org # 5.14 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd934x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index a17cd75b969b..1b6e376f3833 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3044,6 +3044,17 @@ static int wcd934x_mbhc_init(struct snd_soc_component *component) return 0; } + +static void wcd934x_mbhc_deinit(struct snd_soc_component *component) +{ + struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(component); + + if (!wcd->mbhc) + return; + + wcd_mbhc_deinit(wcd->mbhc); +} + static int wcd934x_comp_probe(struct snd_soc_component *component) { struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); @@ -3077,6 +3088,7 @@ static void wcd934x_comp_remove(struct snd_soc_component *comp) { struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); + wcd934x_mbhc_deinit(comp); wcd_clsh_ctrl_free(wcd->clsh_ctrl); } From patchwork Wed Jul 5 12:30:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 699252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E413CEB64DA for ; Wed, 5 Jul 2023 14:44:16 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id ADC3B9F6; Wed, 5 Jul 2023 16:43:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ADC3B9F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568254; bh=wn7CUVVxrOWOl0kh/DRq8DJmjTUPwwGVXxwtuxE9kBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=rqcV2S9bA+IzgLkDC/eMl8Wl31pw7QNcrSd8pir/4yOwH3zgnlN5qtT1NsppdeEqO fslJJupabg7MLSZTZdrzG+oUUsxhxoz0e3rVL03/k0HB0NEDlc1ETnC4yXwfcqpSmI LPPH852RDEuKvZ/TFf0sg0NJJS3LzI76Eap3Topc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B756CF805B4; Wed, 5 Jul 2023 16:41:52 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 59CDCF805B1; Wed, 5 Jul 2023 16:41:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C78ECF80125; Wed, 5 Jul 2023 14:35:13 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F1B02F80104 for ; Wed, 5 Jul 2023 14:33:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F1B02F80104 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=iQteiVQr Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 46BFB6158D; Wed, 5 Jul 2023 12:33:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD18FC433BA; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=wn7CUVVxrOWOl0kh/DRq8DJmjTUPwwGVXxwtuxE9kBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQteiVQr2zXXSIJZcGhyLp5bdPktNo1wKcXW3iBcr+scNrD/ATzB0mxiv3vtz+BP9 yje/CvC2ZTg7hw4yGVsFgYiDAo359/q8VtCtNmChWwB40JlIsdfKapL0ad+VCRTRQR t7FAvlZw7kQwXBhHJ2KmJTYsvjCLsE+nUXwRAsVxAws4EJ5UsB4Hy6kgf6K1Hj3fji +amjTqFZpYjvb1JwZoTGDEqi1cBJilYsGkf78KdOR5kSnYli+gJTvolNm7nMA+sWbo h6tD2W/u+n2VZeUC+zj5kNSp7qDd0T9kR6P0jmpq9CsS4sbyDF8kKmsFORlaakEIe+ Cy29u0las/GsQ== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-00084J-1l; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 6/8] ASoC: codecs: wcd-mbhc-v2: fix resource leaks on component remove Date: Wed, 5 Jul 2023 14:30:16 +0200 Message-Id: <20230705123018.30903-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: MIIORCKAP5XDDBQK7KKPNWY3L3GRKMZP X-Message-ID-Hash: MIIORCKAP5XDDBQK7KKPNWY3L3GRKMZP X-Mailman-Approved-At: Wed, 05 Jul 2023 14:41:38 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The MBHC resources must be released on component probe failure and removal so can not be tied to the lifetime of the component device. This is specifically needed to allow probe deferrals of the sound card which otherwise fails when reprobing the codec component: snd-sc8280xp sound: ASoC: failed to instantiate card -517 genirq: Flags mismatch irq 299. 00002001 (mbhc sw intr) vs. 00002001 (mbhc sw intr) wcd938x_codec audio-codec: Failed to request mbhc interrupts -16 wcd938x_codec audio-codec: mbhc initialization failed wcd938x_codec audio-codec: ASoC: error at snd_soc_component_probe on audio-codec: -16 snd-sc8280xp sound: ASoC: failed to instantiate card -16 Fixes: 0e5c9e7ff899 ("ASoC: codecs: wcd: add multi button Headset detection support") Cc: stable@vger.kernel.org # 5.14 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold Reviewed-by: Srinivas Kandagatla --- sound/soc/codecs/wcd-mbhc-v2.c | 57 ++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c index 1911750f7445..5da1934527f3 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.c +++ b/sound/soc/codecs/wcd-mbhc-v2.c @@ -1454,7 +1454,7 @@ struct wcd_mbhc *wcd_mbhc_init(struct snd_soc_component *component, return ERR_PTR(-EINVAL); } - mbhc = devm_kzalloc(dev, sizeof(*mbhc), GFP_KERNEL); + mbhc = kzalloc(sizeof(*mbhc), GFP_KERNEL); if (!mbhc) return ERR_PTR(-ENOMEM); @@ -1474,61 +1474,76 @@ struct wcd_mbhc *wcd_mbhc_init(struct snd_soc_component *component, INIT_WORK(&mbhc->correct_plug_swch, wcd_correct_swch_plug); - ret = devm_request_threaded_irq(dev, mbhc->intr_ids->mbhc_sw_intr, NULL, + ret = request_threaded_irq(mbhc->intr_ids->mbhc_sw_intr, NULL, wcd_mbhc_mech_plug_detect_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "mbhc sw intr", mbhc); if (ret) - goto err; + goto err_free_mbhc; - ret = devm_request_threaded_irq(dev, mbhc->intr_ids->mbhc_btn_press_intr, NULL, + ret = request_threaded_irq(mbhc->intr_ids->mbhc_btn_press_intr, NULL, wcd_mbhc_btn_press_handler, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "Button Press detect", mbhc); if (ret) - goto err; + goto err_free_sw_intr; - ret = devm_request_threaded_irq(dev, mbhc->intr_ids->mbhc_btn_release_intr, NULL, + ret = request_threaded_irq(mbhc->intr_ids->mbhc_btn_release_intr, NULL, wcd_mbhc_btn_release_handler, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "Button Release detect", mbhc); if (ret) - goto err; + goto err_free_btn_press_intr; - ret = devm_request_threaded_irq(dev, mbhc->intr_ids->mbhc_hs_ins_intr, NULL, + ret = request_threaded_irq(mbhc->intr_ids->mbhc_hs_ins_intr, NULL, wcd_mbhc_adc_hs_ins_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "Elect Insert", mbhc); if (ret) - goto err; + goto err_free_btn_release_intr; disable_irq_nosync(mbhc->intr_ids->mbhc_hs_ins_intr); - ret = devm_request_threaded_irq(dev, mbhc->intr_ids->mbhc_hs_rem_intr, NULL, + ret = request_threaded_irq(mbhc->intr_ids->mbhc_hs_rem_intr, NULL, wcd_mbhc_adc_hs_rem_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "Elect Remove", mbhc); if (ret) - goto err; + goto err_free_hs_ins_intr; disable_irq_nosync(mbhc->intr_ids->mbhc_hs_rem_intr); - ret = devm_request_threaded_irq(dev, mbhc->intr_ids->hph_left_ocp, NULL, + ret = request_threaded_irq(mbhc->intr_ids->hph_left_ocp, NULL, wcd_mbhc_hphl_ocp_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "HPH_L OCP detect", mbhc); if (ret) - goto err; + goto err_free_hs_rem_intr; - ret = devm_request_threaded_irq(dev, mbhc->intr_ids->hph_right_ocp, NULL, + ret = request_threaded_irq(mbhc->intr_ids->hph_right_ocp, NULL, wcd_mbhc_hphr_ocp_irq, IRQF_ONESHOT | IRQF_TRIGGER_RISING, "HPH_R OCP detect", mbhc); if (ret) - goto err; + goto err_free_hph_left_ocp; return mbhc; -err: + +err_free_hph_left_ocp: + free_irq(mbhc->intr_ids->hph_left_ocp, mbhc); +err_free_hs_rem_intr: + free_irq(mbhc->intr_ids->mbhc_hs_rem_intr, mbhc); +err_free_hs_ins_intr: + free_irq(mbhc->intr_ids->mbhc_hs_ins_intr, mbhc); +err_free_btn_release_intr: + free_irq(mbhc->intr_ids->mbhc_btn_release_intr, mbhc); +err_free_btn_press_intr: + free_irq(mbhc->intr_ids->mbhc_btn_press_intr, mbhc); +err_free_sw_intr: + free_irq(mbhc->intr_ids->mbhc_sw_intr, mbhc); +err_free_mbhc: + kfree(mbhc); + dev_err(dev, "Failed to request mbhc interrupts %d\n", ret); return ERR_PTR(ret); @@ -1537,9 +1552,19 @@ EXPORT_SYMBOL(wcd_mbhc_init); void wcd_mbhc_deinit(struct wcd_mbhc *mbhc) { + free_irq(mbhc->intr_ids->hph_right_ocp, mbhc); + free_irq(mbhc->intr_ids->hph_left_ocp, mbhc); + free_irq(mbhc->intr_ids->mbhc_hs_rem_intr, mbhc); + free_irq(mbhc->intr_ids->mbhc_hs_ins_intr, mbhc); + free_irq(mbhc->intr_ids->mbhc_btn_release_intr, mbhc); + free_irq(mbhc->intr_ids->mbhc_btn_press_intr, mbhc); + free_irq(mbhc->intr_ids->mbhc_sw_intr, mbhc); + mutex_lock(&mbhc->lock); wcd_cancel_hs_detect_plug(mbhc, &mbhc->correct_plug_swch); mutex_unlock(&mbhc->lock); + + kfree(mbhc); } EXPORT_SYMBOL(wcd_mbhc_deinit); From patchwork Wed Jul 5 12:30:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 700085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0701BEB64DA for ; Wed, 5 Jul 2023 14:43:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C3D3584D; Wed, 5 Jul 2023 16:42:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C3D3584D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568206; bh=dSIi6iSQrZcwHBgwfGJF2PaWQmJdlHaoNoR7kIW6AWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RvCrVBYkxnvsCVFleHzL8GEQsSxPQGFEifXKVB/05wHOigpcRjffMR0aotqPUCerN yqIxzMmKy4ydrmSkOsu2Gq4SlzPvc3ISv0MBsz6jGcmrONxfzcXaBUd+kxL6NdkNAG vxdYTu5hcELRiUof6jWeWFzk721kpf0TMZTUGwaQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id AC344F8057B; Wed, 5 Jul 2023 16:41:45 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 033C5F80568; Wed, 5 Jul 2023 16:41:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C3A5DF8025F; Wed, 5 Jul 2023 14:33:26 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9B4E5F8053B for ; Wed, 5 Jul 2023 14:33:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9B4E5F8053B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=LzN+lNYV Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D7ACB61574; Wed, 5 Jul 2023 12:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5E10C433BD; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=dSIi6iSQrZcwHBgwfGJF2PaWQmJdlHaoNoR7kIW6AWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LzN+lNYV2vZg4H9gENrrC6S4iEtnSjbuaAMDlT4SwILg4/z7V0Qdovnpeu/pzfK1M Q+ctGGcaD8nzUIpSHwHh1cpUp8W583nWBufO0LIC2VlZ072W/pJrIFrcb57wuRcpIp 5hge0sli/lraHNXfY4ziya9+OgNzXr5AQZixhA0IMTrCUF+/kDet7QlBhgz6xPm9fP +K5gaSo9nnbpC1iMMGVniPOvenW1gy7BsF6+0c9S4wnj5t6Jn8lbVguA3fiTygfAZF CQSDcs5a9Rkh98cNY2jFSoQWUClevB4HqouDDW9LrtRHe7Rbtk0dwCKu3omSzAbWcC rMeLgQpNmPD/A== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-00084M-25; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 7/8] ASoC: topology: suppress probe deferral errors Date: Wed, 5 Jul 2023 14:30:17 +0200 Message-Id: <20230705123018.30903-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 37KVCR22JK74QJELHHD5EHPG7ZMMZ7WX X-Message-ID-Hash: 37KVCR22JK74QJELHHD5EHPG7ZMMZ7WX X-Mailman-Approved-At: Wed, 05 Jul 2023 14:41:37 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Suppress probe deferral error messages when loading topologies and creating frontend links to avoid spamming the logs when a component has not yet been registered: snd-sc8280xp sound: ASoC: adding FE link failed snd-sc8280xp sound: ASoC: topology: could not load header: -517 Note that dev_err_probe() is not used as the topology component can be probed and removed while the underlying platform device remains bound to its driver. Signed-off-by: Johan Hovold --- sound/soc/soc-topology.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index d0aca6b9058b..696c9647debe 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1751,7 +1751,8 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, ret = snd_soc_add_pcm_runtimes(tplg->comp->card, link, 1); if (ret < 0) { - dev_err(tplg->dev, "ASoC: adding FE link failed\n"); + if (ret != -EPROBE_DEFER) + dev_err(tplg->dev, "ASoC: adding FE link failed\n"); goto err; } @@ -2514,8 +2515,11 @@ static int soc_tplg_process_headers(struct soc_tplg *tplg) /* load the header object */ ret = soc_tplg_load_header(tplg, hdr); if (ret < 0) { - dev_err(tplg->dev, - "ASoC: topology: could not load header: %d\n", ret); + if (ret != -EPROBE_DEFER) { + dev_err(tplg->dev, + "ASoC: topology: could not load header: %d\n", + ret); + } return ret; } From patchwork Wed Jul 5 12:30:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 699254 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2DCC2C00528 for ; Wed, 5 Jul 2023 14:43:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 31A07741; Wed, 5 Jul 2023 16:42:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 31A07741 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688568201; bh=f6yTboHdDxAlYnmIQ62ZL53MjCiOLY54svw8nFvYa9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=TsQYbyCMXojerl3smY/DCkQDCxksik2U0nBif1v9lIEJe1c2L0W74G6Ynhv5HZ9lX JdMAZ5ANcR68yjFh6FxxzUWIxFLYvhX06bp8ad1r7ObPhazb+Cu5ab56gkaKrdyNmI NOYoWWmaKny5wNwn1tcdsZBiDNet9+UdWjMJyee0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 52E20F8055C; Wed, 5 Jul 2023 16:41:43 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id AD5E9F80553; Wed, 5 Jul 2023 16:41:42 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AB181F80552; Wed, 5 Jul 2023 14:33:25 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9365EF80535 for ; Wed, 5 Jul 2023 14:33:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9365EF80535 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hftrEYWe Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DCED661584; Wed, 5 Jul 2023 12:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6BCBC61180; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=f6yTboHdDxAlYnmIQ62ZL53MjCiOLY54svw8nFvYa9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hftrEYWeSMZIfjIEg07Y6+0dHdPyzdBS2xzN7RS9Wr85NheRLLfBNEceT3aMvGVC7 7VsXgQaoUle+/v3YCEBGdUlVAHb1nDUrxnWSIFIHT+WckFCaTA3mpAxEWWyoFHXtHS wYStwMUAypCluPlvQ32frttjV0TOja268wd5fu3gQ+TaOxcx1GcM1V2ZhUhftvZGg6 YWtyZTjk1WzZcGbi1T7j5oI4XFvEpD46APG79mSiGT0jS+32s8Fda4Wn2F0sWRN+PT n2ZNotMGM+AOKg29dMtZmMAGl995QUpxi5HTIo3PF6aqOunw3Il7yMPKcLhDPa5BMF F00koUNwRkvEA== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qH1hK-00084Q-2K; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold To: Mark Brown , Vinod Koul Cc: Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 8/8] ASoC: core: suppress probe deferral errors Date: Wed, 5 Jul 2023 14:30:18 +0200 Message-Id: <20230705123018.30903-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 32PYKRAYL5IOM3T4CYQALSPFUPKAMGO4 X-Message-ID-Hash: 32PYKRAYL5IOM3T4CYQALSPFUPKAMGO4 X-Mailman-Approved-At: Wed, 05 Jul 2023 14:41:37 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Suppress probe deferral error messages when probing link components to avoid spamming the logs, for example, if a required component has not yet been registered: snd-sc8280xp sound: ASoC: failed to instantiate card -517 Note that dev_err_probe() is not used as the card can be unbound and rebound while the underlying platform device remains bound to its driver. Signed-off-by: Johan Hovold --- sound/soc/soc-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b48efc3a08d2..b9cb5c4e3685 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1988,8 +1988,10 @@ static int snd_soc_bind_card(struct snd_soc_card *card) /* probe all components used by DAI links on this card */ ret = soc_probe_link_components(card); if (ret < 0) { - dev_err(card->dev, - "ASoC: failed to instantiate card %d\n", ret); + if (ret != -EPROBE_DEFER) { + dev_err(card->dev, + "ASoC: failed to instantiate card %d\n", ret); + } goto probe_end; }