From patchwork Thu Jul 7 12:56:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 12909552 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 42C9AC433EF for ; Thu, 7 Jul 2022 12:58:06 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 86AA11634; Thu, 7 Jul 2022 14:57:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 86AA11634 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657198684; bh=9Ji9iZZVXLOK+QnEpKIfNswLmhsOxmQFN8OKZLw48FA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iuMNi9WjQLAZWApyc/k/OXw6xK2goSWDaBn+B9CziYTWGLomS8QiqduVqSbfA1wiT LszJzzwNqPPPL3lAcLei9IpsSqZXJwwjDCUw8TFqFMoCNvTEjvNM/zX4WBcrOvsZrF K/KChXs/iL1sRuJv/gYdQ7rtETAZMLtrmycqcMo4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 47664F800C5; Thu, 7 Jul 2022 14:56:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2D2CAF8052E; Thu, 7 Jul 2022 14:56:48 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C2179F804F1 for ; Thu, 7 Jul 2022 14:56:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C2179F804F1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gPY3Nt4Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657198605; x=1688734605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9Ji9iZZVXLOK+QnEpKIfNswLmhsOxmQFN8OKZLw48FA=; b=gPY3Nt4Y6cxTQ0FDxteZUvsVI832ErH5iYe3xCpcP98Lyx6AgtPdlB7X AXKY03LUYJos2mZ0zX6Fn+kPHJWbRLdXpRqTdwUAlh0Lylat848mOpFx5 qoClGgrSutdQZE7OJkYyCDTEB1iy7rp24nwzPVaTZXLhp+QNhjkqABWdq lIOQltaPEhc+xR1pVF5bT/b9ULLlq3ua73H43LvPbmHOVzMdWpyMRJTiM awTOEZf1N92BlrJTZm9eZNMGbD3vL4Q+wVmMIITnpYL8ilYsFEhRY6Dur vZSU8s0Z8pcCJfr9RCbW5qZBGzRZKMVi8VzcnEuCm7fM7xzdCmfidwORb g==; X-IronPort-AV: E=McAfee;i="6400,9594,10400"; a="272810607" X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="272810607" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 05:56:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="620781726" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga008.jf.intel.com with ESMTP; 07 Jul 2022 05:56:37 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH v2 1/5] ASoC: codecs: rt298: Fix NULL jack in interrupt Date: Thu, 7 Jul 2022 14:56:57 +0200 Message-Id: <20220707125701.3518263-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> References: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Set rt298->jack to passed value in mic_detect, otherwise when jack is set to NULL on next interrupt call, we may use freed pointer. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt298.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 266a2cc55b8d..6a615943f983 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -335,6 +335,8 @@ static int rt298_mic_detect(struct snd_soc_component *component, bool mic = false; int status = 0; + rt298->jack = jack; + /* If jack in NULL, disable HS jack */ if (!jack) { regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0); @@ -344,7 +346,6 @@ static int rt298_mic_detect(struct snd_soc_component *component, return 0; } - rt298->jack = jack; regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); rt298_jack_detect(rt298, &hp, &mic); From patchwork Thu Jul 7 12:56:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 12909553 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 1DFE4C43334 for ; Thu, 7 Jul 2022 12:58:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 30C971658; Thu, 7 Jul 2022 14:57:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 30C971658 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657198706; bh=BLX4nPxP/PfKQ+GqHozmOYLg5BxuFUZOPahoRi+A6NE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SR84GNKyamOBxC1+bjK5jC+ZErTY6bmkYaMOQsp1zO0g8Qo6X+418wSLwu828flwm mv28BXEwiAJMJkUHx7ec8qitpBv3mtStEvR5fr/8QrGcv97B5KDQCZOBvnwHM7mqju zkuiz0PUDch/AwB0WZtgNxHmihn+8/TpatYEtd5k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EED88F804FB; Thu, 7 Jul 2022 14:56:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 148D8F800C5; Thu, 7 Jul 2022 14:56:49 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3F7DCF800C5 for ; Thu, 7 Jul 2022 14:56:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3F7DCF800C5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UfFoWt43" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657198603; x=1688734603; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BLX4nPxP/PfKQ+GqHozmOYLg5BxuFUZOPahoRi+A6NE=; b=UfFoWt434aDMEtyA64KqYFse9ql81ZiYQPqg60V9PcbexfDYx4lEQMZV iWFp6Vys8tAeHNVlK23UsRmC1dCy4LBaGJ8KYqhbdPXJKkffNHex1W3zv jux9VDcYHb/FgHRIbpnph8mWFJ39HYQwWqbuCNZbKJhUnGX7meSawzWWu MCnqWvEb4cDjhbeNO6ZlNNglQxm74e1tyH7K7HSdn+zSsQq9Y1LEjTiW0 4O7g+f6kkJQTRTBzJPii83uWU9Q/UsEGgxSDP6xqvzmIVI/FCDNoi4gZx XiIai76rwjWo+liPq7M8elVsuplem4TVP+Tzwy58pSHwtWP431m8YPEQK g==; X-IronPort-AV: E=McAfee;i="6400,9594,10400"; a="272810612" X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="272810612" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 05:56:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="620781738" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga008.jf.intel.com with ESMTP; 07 Jul 2022 05:56:39 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH v2 2/5] ASoC: codecs: rt298: Fix jack detection Date: Thu, 7 Jul 2022 14:56:58 +0200 Message-Id: <20220707125701.3518263-3-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> References: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On our RVP platforms using rt298 with combojack we've seen issues with controls being in incorrect state after suspend/resume cycle. This is caused by codec driver not setting pins to correct state and causing codec suspend method to not be called. Which on resume caused codec registers to be in undefined state. Fix this by setting pins correctly in jack detect function. Above problem is caused by the fact that when jack == NULL code doesn't reach rt298_jack_detect() function which sets pins. Alternatively problem could be fixed by just moving rt298_jack_detect, but as rt298 codec is similar to rt286, align the code by setting pins explicitly. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt298.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 6a615943f983..e1d94f128fd9 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -329,34 +329,31 @@ static void rt298_jack_detect_work(struct work_struct *work) static int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data) { + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); - struct snd_soc_dapm_context *dapm; - bool hp = false; - bool mic = false; - int status = 0; rt298->jack = jack; - /* If jack in NULL, disable HS jack */ - if (!jack) { + if (jack) { + /* Enable IRQ */ + if (rt298->jack->status & SND_JACK_HEADPHONE) + snd_soc_dapm_force_enable_pin(dapm, "LDO1"); + if (rt298->jack->status & SND_JACK_MICROPHONE) { + snd_soc_dapm_force_enable_pin(dapm, "HV"); + snd_soc_dapm_force_enable_pin(dapm, "VREF"); + } + regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); + /* Send an initial empty report */ + snd_soc_jack_report(rt298->jack, rt298->jack->status, + SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); + } else { + /* Disable IRQ */ regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0); - dapm = snd_soc_component_get_dapm(component); + snd_soc_dapm_disable_pin(dapm, "HV"); + snd_soc_dapm_disable_pin(dapm, "VREF"); snd_soc_dapm_disable_pin(dapm, "LDO1"); - snd_soc_dapm_sync(dapm); - return 0; } - - regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); - - rt298_jack_detect(rt298, &hp, &mic); - if (hp) - status |= SND_JACK_HEADPHONE; - - if (mic) - status |= SND_JACK_MICROPHONE; - - snd_soc_jack_report(rt298->jack, status, - SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); + snd_soc_dapm_sync(dapm); return 0; } From patchwork Thu Jul 7 12:56:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 12909554 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 2DB08C43334 for ; Thu, 7 Jul 2022 12:58:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 669D31620; Thu, 7 Jul 2022 14:57:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 669D31620 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657198716; bh=48xYBzIKX0PEgKorZ5dr85JNDLgv4rXOCMdCy1UhRyk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DVAXmwk67nTdJUbi20IoQehrL0TuT9NeBSfwTcfgzyULcnP8fHhLrSj3x7omy9VAP ze0PSugoEQMhUmvwtDGP88U5SxPUHxmfDUwU3F5ktwctrD74xUqZSOLiF6xy+Wb24Z t4EH6csWFTZGqHKAIV2qeLlbeCXnujiS9BUjMjgk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7835DF8053B; Thu, 7 Jul 2022 14:56:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9BD9F80537; Thu, 7 Jul 2022 14:56:49 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5F35AF804FB for ; Thu, 7 Jul 2022 14:56:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5F35AF804FB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="R0Pfb6n+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657198605; x=1688734605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=48xYBzIKX0PEgKorZ5dr85JNDLgv4rXOCMdCy1UhRyk=; b=R0Pfb6n+q3aaYowORdIxGxnFZ1CggPHPUsVhfoSgs2zyWXZKXbnKExyB lJqSWTREpr8ZCFTvFphys0/hWp+mqpGvmGo4u5YM4eFcoHs8xjvKUbI2K gTWByOBYIMmirPcxNOa5li3uHUMh4RUqrJ5vuJY0aAu56t9F5R5KBglgY cHb8FJ3Y4XbK7JtvO0rA4U3J+xnXQtiteQV0dgUENbOTlitYHh8YfKIGq pKtJSYp25RLyM5L2onzY4CXi4+bgaKV9dMXO65lSQdpw0vEp25PGRbdcN C1Kuo3Bl7atVCiDql/IwWJwJ1C6W/vtzmY3VBxeScWDBiWChRzRaSyeJT w==; X-IronPort-AV: E=McAfee;i="6400,9594,10400"; a="272810622" X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="272810622" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 05:56:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="620781748" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga008.jf.intel.com with ESMTP; 07 Jul 2022 05:56:42 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH v2 3/5] ASoC: codecs: rt286: Set component to NULL on remove Date: Thu, 7 Jul 2022 14:56:59 +0200 Message-Id: <20220707125701.3518263-4-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> References: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Make sure that component is set to proper value, otherwise we may dereference freed component in interrupt. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt286.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index b2b0b2b1e4d0..c4f7c4c2d793 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -960,6 +960,7 @@ static void rt286_remove(struct snd_soc_component *component) struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); cancel_delayed_work_sync(&rt286->jack_detect_work); + rt286->component = NULL; } #ifdef CONFIG_PM From patchwork Thu Jul 7 12:57:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 12909563 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 571F0C433EF for ; Thu, 7 Jul 2022 12:59:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3658F1622; Thu, 7 Jul 2022 14:58:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3658F1622 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657198748; bh=AzTM3SmQRFfNYnQkQRvC+We0enMtYhZMtZYvOWjpu3w=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JB9v23qqvQONQt1EgClM8EzAXKlPlq80tJJLWMbXGpjVv/vggat30FPFr5lOz7GHp pi1hr71hVSIrri+QqtqUKn7abYNvF4gbXjDGr051cI/U/7URwYsm5/gBnl5FkVql/d 8jy3nfLVOwfvGTld7tT8KEoBE0PWkUUUmHOWpvRc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7AB72F80549; Thu, 7 Jul 2022 14:56:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E99B2F80544; Thu, 7 Jul 2022 14:56:54 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6DE74F804FA for ; Thu, 7 Jul 2022 14:56:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6DE74F804FA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lH81vuB5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657198609; x=1688734609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AzTM3SmQRFfNYnQkQRvC+We0enMtYhZMtZYvOWjpu3w=; b=lH81vuB5qyZg1sbF7ktcFjHnL0WnZ2TOizECA9qnmB7gW169avtbXYkQ vlFRE3pIgN/SvIbrNhjNcrMWp4mePEX2a4IdD3qPaPVPwVmZP/rx4W0jP EEOyztVCsv9wpInepBATuTZhNOOf4d1zxzIip5RM9DWJh4atQW8+nDV4x lk9h5+Xo+uowPCrqs2EcSsUrI3XnmXT1su0+jjMWwLoKxc6FYqXbrqvZ6 g62nrSASjegGsxy4MhMArNWuDoVbHPQ9Er/R8zc0mN687+LhrR2SUf5i/ zJtODyr0OE7I5lqx3nk5Lg1ukXrCcqElwAWwb9tYStPGDgy3HvlMXNuRA A==; X-IronPort-AV: E=McAfee;i="6400,9594,10400"; a="272810626" X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="272810626" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 05:56:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="620781769" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga008.jf.intel.com with ESMTP; 07 Jul 2022 05:56:44 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH v2 4/5] ASoC: codecs: rt298: Set component to NULL on remove Date: Thu, 7 Jul 2022 14:57:00 +0200 Message-Id: <20220707125701.3518263-5-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> References: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Make sure that component is set to proper value, otherwise we may dereference freed component in interrupt. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt298.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index e1d94f128fd9..b0b53d4f07df 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -1022,6 +1022,7 @@ static void rt298_remove(struct snd_soc_component *component) struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); cancel_delayed_work_sync(&rt298->jack_detect_work); + rt298->component = NULL; } #ifdef CONFIG_PM From patchwork Thu Jul 7 12:57:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 12909562 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 D9097C43334 for ; Thu, 7 Jul 2022 12:58:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2A031167E; Thu, 7 Jul 2022 14:58:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2A031167E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657198731; bh=pHK4ONpmi/hffbIZWIVp+R0sZZyRbxatAn5qwlGW0G8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DdhFWco/Tq6bAcau7D0U14A2xf+NtQKiqTnRAnUdloQOPwRBINNUsC30LCmOqdvAS t+8779fQMKPXInMF/lVgH9iHic55iU28a0na7cPVqnwpbj9NSXaPP49gaCIs0GoYMw hhlDBUleZ0yqhXc69Wa2wZYqlHQF7bwJMIc01jfQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 01A93F8053A; Thu, 7 Jul 2022 14:56:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 63D26F80544; Thu, 7 Jul 2022 14:56:53 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5DA9EF8053A for ; Thu, 7 Jul 2022 14:56:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5DA9EF8053A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gNeFgtoj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657198611; x=1688734611; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pHK4ONpmi/hffbIZWIVp+R0sZZyRbxatAn5qwlGW0G8=; b=gNeFgtoj7lJpRRSBgKHeYGSclmCTmpPX8F389hgrnlG8fqRO0YmMS3yF xG6AFLzavcMG+qIq/l+mki7Q30FtRUksvmmZ5LHzgMc/qPfGDfiUSZY+U YVng5RlBXWERT+AnJwPicWvm7JPmmqo/6KP+HhJn/SU5PMJxokEVOjB6P pMon1XbNVoduwiCfYT0xiDgBU5hWzpWE5UIMr2p3gxHl55mfAT8b8kuvd fw7FVp1nvG6Eh/hGWMdmoPr/oIjYN4aXKNaITXMTlzaUovUDF2ytYUIjz 9tOiVTiw6QD20+tC60WtGsD5GKAZo2oviK9ReoGFqupsxXziExg71FA/Z A==; X-IronPort-AV: E=McAfee;i="6400,9594,10400"; a="272810635" X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="272810635" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 05:56:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="620781781" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga008.jf.intel.com with ESMTP; 07 Jul 2022 05:56:46 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH v2 5/5] ASoC: codecs: rt274: Set component to NULL on remove Date: Thu, 7 Jul 2022 14:57:01 +0200 Message-Id: <20220707125701.3518263-6-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> References: <20220707125701.3518263-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Make sure that component is set to proper value, otherwise we may dereference freed component in interrupt. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt274.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index 6b208f9eb503..f2c50b11e4d0 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -993,6 +993,7 @@ static void rt274_remove(struct snd_soc_component *component) struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); cancel_delayed_work_sync(&rt274->jack_detect_work); + rt274->component = NULL; } #ifdef CONFIG_PM