From patchwork Mon Jan 2 20:30:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13086992 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 E33B7C3DA7A for ; Mon, 2 Jan 2023 20:31:43 +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 83C7EA8C3; Mon, 2 Jan 2023 21:30:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 83C7EA8C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1672691501; bh=Tuh2SSmJnpDPTtlBWbyywMESzagl6YRuFPwYuCTfJEU=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=StADf+tfdu9ySx7yA1MocWjY6tqORYa9YaclnlBFsvJQJ3cvLazua8CA3dci56t/+ oPJoVfeY7a2RET87JjMrlcyl03MoG3vzfDAh1ebtNJZQeDhZPSejx4s8uCIGg2/wui lVuBm1JReONrTZn+SSv/7qnuF4LI7/JNES1oihu0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7C738F8032D; Mon, 2 Jan 2023 21:30:03 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9B74BF80542; Mon, 2 Jan 2023 21:30:01 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 AA9C1F80238 for ; Mon, 2 Jan 2023 21:29:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AA9C1F80238 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YIMbhNSa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672691395; x=1704227395; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Tuh2SSmJnpDPTtlBWbyywMESzagl6YRuFPwYuCTfJEU=; b=YIMbhNSawYVPDiM9zPcVcZ1NwEJNAhmESfA56amU5LPMjm7PBqgrjYCu G4m3yQVE8emX1CqJUGbq0/I1cTwnRBbbCQmNLtampmVHx58FLGb1P0H/2 eXF8DwgXoVDNOIEwyHBcVF73U+Ymw/Oh+hreFVO9VLpuT+VkZKKeleg5L +usfZrS2Ttyzsjm+GdrwqgObuuZF4iqRArOqpRktoocg3mZQEqq8RBxWJ zUClpRHHfvyghrVgagSgFgcQRvrK6RlheSzODAwRxcm1AE+RmGjozWzRn OIhOq+I6Z3MtCOUCa7LysTg5qXNlktIx06uprNzXLiOOVQ5c5Xhv/6sQ6 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="320252183" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="320252183" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 12:29:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="685170309" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="685170309" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 02 Jan 2023 12:29:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A66E3F4; Mon, 2 Jan 2023 22:30:16 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Vijendar Mukunda , Hans de Goede , Pierre-Louis Bossart , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/6] ASoC: amd: acp-es8336: Drop reference count of ACPI device after use Date: Mon, 2 Jan 2023 22:30:09 +0200 Message-Id: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Cezary Rojewski , Andy Shevchenko , Kai Vehmanen , Peter Ujfalusi , Takashi Iwai , Liam Girdwood , Ranjani Sridharan , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Theoretically the device might gone if its reference count drops to 0. This might be the case when we try to find the first physical node of the ACPI device. We need to keep reference to it until we get a result of the above mentioned call. Refactor the code to drop the reference count at the correct place. While at it, move to acpi_dev_put() as symmetrical call to the acpi_dev_get_first_match_dev(). Fixes: 02527c3f2300 ("ASoC: amd: add Machine driver for Jadeite platform") Signed-off-by: Andy Shevchenko Acked-by: Vijendar Mukunda --- sound/soc/amd/acp-es8336.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/acp-es8336.c b/sound/soc/amd/acp-es8336.c index 2fe8df86053a..89499542c803 100644 --- a/sound/soc/amd/acp-es8336.c +++ b/sound/soc/amd/acp-es8336.c @@ -198,9 +198,11 @@ static int st_es8336_late_probe(struct snd_soc_card *card) int ret; adev = acpi_dev_get_first_match_dev("ESSX8336", NULL, -1); - if (adev) - put_device(&adev->dev); + if (!adev) + return -ENODEV; + codec_dev = acpi_get_first_physical_node(adev); + acpi_dev_put(adev); if (!codec_dev) dev_err(card->dev, "can not find codec dev\n"); From patchwork Mon Jan 2 20:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13086990 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 663D7C46467 for ; Mon, 2 Jan 2023 20:30: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 89A80A8B4; Mon, 2 Jan 2023 21:30:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 89A80A8B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1672691450; bh=XBGxwjOTps8fLgKAqKNuNDLJBvUHEDjGUgWj7WtL0nw=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=ogBdALj02yB42yHKmO5+ac64JPio9Kf5hV9qmrjul5P6JWGLqWpMkT/6G9ex2FK8r zByWc15dD1Jjb2bt7Tl740z9F4fnM4NTE8bL9Dg77TPsPegy6f219zCendx3dLxZrM bVTicMYRvysvmKC0PhnMbPlPrVEbyik0pH3FCRq4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 33F45F800D0; Mon, 2 Jan 2023 21:30:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8BB42F80507; Mon, 2 Jan 2023 21:29:58 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 B6EB3F800D0 for ; Mon, 2 Jan 2023 21:29:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B6EB3F800D0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ADrmyryP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672691393; x=1704227393; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XBGxwjOTps8fLgKAqKNuNDLJBvUHEDjGUgWj7WtL0nw=; b=ADrmyryP5uDQdHa+P+oA+Wq52PpCaonGuZrfjLJxNWXbiHJ5dMC+9mdw 55+z9XXb/Wb3mmhSAUXYkWm0mLrzoaWj4ccBU3VkdmIfChI3ggCxHJi6+ SHG8buR8cIC2xYVUgiNelkfuJdiFZK881t9mI+5lt6dVX0xJx6ld9TpYM xOxTEDpesjSatTy4NLwoBNTpDshaVeHL+WtAAKshjXwT+1ArmeS2pyt5s ds3OOOpFFZlDbMRobqgG2DNVLz4Ss5Oo7Qxy7bJgCTV3KACVqGrGxh9le NhD+ndclm3Pa77LqnZfXZQ/R09h348uWe9Z7O9jcUtnP+6aIVCOX1PKPB g==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="321602407" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="321602407" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 12:29:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="717889959" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="717889959" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Jan 2023 12:29:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id B3ECC84; Mon, 2 Jan 2023 22:30:16 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Vijendar Mukunda , Hans de Goede , Pierre-Louis Bossart , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/6] ASoC: Intel: bytcht_es8316: Drop reference count of ACPI device after use Date: Mon, 2 Jan 2023 22:30:10 +0200 Message-Id: <20230102203014.16041-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> References: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Cezary Rojewski , Andy Shevchenko , Kai Vehmanen , Peter Ujfalusi , Takashi Iwai , Liam Girdwood , Ranjani Sridharan , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Theoretically the device might gone if its reference count drops to 0. This might be the case when we try to find the first physical node of the ACPI device. We need to keep reference to it until we get a result of the above mentioned call. Refactor the code to drop the reference count at the correct place. While at it, move to acpi_dev_put() as symmetrical call to the acpi_dev_get_first_match_dev(). Fixes: 3c22a73fb873 ("ASoC: Intel: bytcht_es8316: fix HID handling") Signed-off-by: Andy Shevchenko --- sound/soc/intel/boards/bytcht_es8316.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c index 09d1f0f6d686..df157b01df8b 100644 --- a/sound/soc/intel/boards/bytcht_es8316.c +++ b/sound/soc/intel/boards/bytcht_es8316.c @@ -497,21 +497,28 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) if (adev) { snprintf(codec_name, sizeof(codec_name), "i2c-%s", acpi_dev_name(adev)); - put_device(&adev->dev); byt_cht_es8316_dais[dai_index].codecs->name = codec_name; } else { dev_err(dev, "Error cannot find '%s' dev\n", mach->id); return -ENXIO; } + codec_dev = acpi_get_first_physical_node(adev); + acpi_dev_put(adev); + if (!codec_dev) + return -EPROBE_DEFER; + priv->codec_dev = get_device(codec_dev); + /* override platform name, if required */ byt_cht_es8316_card.dev = dev; platform_name = mach->mach_params.platform; ret = snd_soc_fixup_dai_links_platform_name(&byt_cht_es8316_card, platform_name); - if (ret) + if (ret) { + put_device(codec_dev); return ret; + } /* Check for BYTCR or other platform and setup quirks */ dmi_id = dmi_first_match(byt_cht_es8316_quirk_table); @@ -539,13 +546,10 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) /* get the clock */ priv->mclk = devm_clk_get(dev, "pmc_plt_clk_3"); - if (IS_ERR(priv->mclk)) + if (IS_ERR(priv->mclk)) { + put_device(codec_dev); return dev_err_probe(dev, PTR_ERR(priv->mclk), "clk_get pmc_plt_clk_3 failed\n"); - - codec_dev = acpi_get_first_physical_node(adev); - if (!codec_dev) - return -EPROBE_DEFER; - priv->codec_dev = get_device(codec_dev); + } if (quirk & BYT_CHT_ES8316_JD_INVERTED) props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted"); From patchwork Mon Jan 2 20:30:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13086995 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 8C0F2C46467 for ; Mon, 2 Jan 2023 20:32:24 +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 A1BA0A8BF; Mon, 2 Jan 2023 21:31:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A1BA0A8BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1672691540; bh=REg3sRJeCK62YhYgQJa6h4HICvITSloNV8ZmQioK800=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=stzyJnLoLyBZYU7qkiHkiER05JAjt3sSlw9U9p+inHcGgt3MYczvCdYG+YcSfg1qg zu9fPS5gTvpr36Ze6okUeVFhbpzm+lh9oVgZAK+Z2VwRzP7j6iAm7o62PN5hODsjoM AbnbY84O1iC8PVTgs2PLWZl9QSoSf+e7Xw4GPIYk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B89F9F8055B; Mon, 2 Jan 2023 21:30:07 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 92FD5F80543; Mon, 2 Jan 2023 21:30:04 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 5E77CF801EB for ; Mon, 2 Jan 2023 21:29:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5E77CF801EB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LAcnE/3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672691396; x=1704227396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=REg3sRJeCK62YhYgQJa6h4HICvITSloNV8ZmQioK800=; b=LAcnE/3EavNqaZGHQgRhoJMuzOHNvEkBFLBo/hAhDmxdFcEdUNo6LtHG AJOIIyfTJfP9BG+IVWoptarK3yKS0u+u6wvD+0E/iQmUzobmwTG+9EXD/ Pu3oEsxgzdGc1nqcSD9U2FAaTSGjrc323CZa5jxdTvx9nooyZNd7p/Ftj ZY4Hz5u+ABqgu0hi6z0GZys+0UrPdHpPTHF13HHngukmrBKnfydlyPnC0 xGoOmq+mLgLMbxD8h3rY2qHI/UwdDL6z95PJmokzcj5q9aFP0e2dkIcAt lNUDRKWrYmJ2qGMpZdI3QxKlEfb5lTdUJaQg3Hyjk97We5rvDPSI6kjay g==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="320252191" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="320252191" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 12:29:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="685170314" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="685170314" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 02 Jan 2023 12:29:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C1F4519E; Mon, 2 Jan 2023 22:30:16 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Vijendar Mukunda , Hans de Goede , Pierre-Louis Bossart , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/6] ASoC: Intel: bytcr_rt5651: Drop reference count of ACPI device after use Date: Mon, 2 Jan 2023 22:30:11 +0200 Message-Id: <20230102203014.16041-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> References: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Cezary Rojewski , Andy Shevchenko , Kai Vehmanen , Peter Ujfalusi , Takashi Iwai , Liam Girdwood , Ranjani Sridharan , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Theoretically the device might gone if its reference count drops to 0. This might be the case when we try to find the first physical node of the ACPI device. We need to keep reference to it until we get a result of the above mentioned call. Refactor the code to drop the reference count at the correct place. While at it, move to acpi_dev_put() as symmetrical call to the acpi_dev_get_first_match_dev(). Fixes: 02c0a3b3047f ("ASoC: Intel: bytcr_rt5651: add MCLK, quirks and cleanups") Signed-off-by: Andy Shevchenko --- sound/soc/intel/boards/bytcr_rt5651.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c index 81ac6eeda2e6..8fca9b82d4d0 100644 --- a/sound/soc/intel/boards/bytcr_rt5651.c +++ b/sound/soc/intel/boards/bytcr_rt5651.c @@ -922,7 +922,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) if (adev) { snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name), "i2c-%s", acpi_dev_name(adev)); - put_device(&adev->dev); byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name; } else { dev_err(dev, "Error cannot find '%s' dev\n", mach->id); @@ -930,6 +929,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) } codec_dev = acpi_get_first_physical_node(adev); + acpi_dev_put(adev); if (!codec_dev) return -EPROBE_DEFER; priv->codec_dev = get_device(codec_dev); From patchwork Mon Jan 2 20:30:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13086991 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 F1448C3DA7A for ; Mon, 2 Jan 2023 20:31:19 +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 9CDEEA8BC; Mon, 2 Jan 2023 21:30:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9CDEEA8BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1672691477; bh=7rKbo4AdxYG+GzOO5clxIrqEj+fvxpX/EkpIQCJnFrg=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=JoM1zNlTfUYz49JqPxLU/P/f4gTWYVfQRASNqkx4gKZrfA6X4O2sod7REQJBtCFeV rwakIuFO6ER7x5WF5puUxnjDJIOdAmXfnS6Nq1aQj0bTryOcrc3lhyAbq2smPr/0Sn UX0NabbvwlDjzd5/2HjLkZUNMt9Pn54prDioj4rk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C4E64F80539; Mon, 2 Jan 2023 21:30:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 63FBFF804A9; Mon, 2 Jan 2023 21:29:59 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 AD4D2F80240 for ; Mon, 2 Jan 2023 21:29:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AD4D2F80240 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bT0uquRk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672691395; x=1704227395; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7rKbo4AdxYG+GzOO5clxIrqEj+fvxpX/EkpIQCJnFrg=; b=bT0uquRk0G7CW4mFH6PFeUAgj0m2vHVvnB4jCeOs9350i3VlRJYvmIkc EUgjLRGwI6YcgtJCjRb+ZtUnqDdq+nqIY7MqkrT8MrDjswyuMrV3EHHu+ tr2f7f/k5pzIQd/csBI1eEkZkJXMN6QRnDuoxdmHEvRZlWMyRSitKz679 uWwVb3GqEIWsEHLeQvwg1MCHSWGt4NT5hAmUNbQiLvT3JIhzYaBnRqjBL PVuGp9+38618rPiuM5Ug8xTD837a4MsFp1YAEwxjrASC19rV/r8ODWW2G Natjqlrm3gJiDqWvj6LHIspM/auqmibRGCQ+xSpNI7soac5EXENkmNCph g==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="321602415" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="321602415" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 12:29:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="717889964" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="717889964" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Jan 2023 12:29:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id CC47B162; Mon, 2 Jan 2023 22:30:16 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Vijendar Mukunda , Hans de Goede , Pierre-Louis Bossart , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/6] ASoC: Intel: bytcr_rt5640: Drop reference count of ACPI device after use Date: Mon, 2 Jan 2023 22:30:12 +0200 Message-Id: <20230102203014.16041-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> References: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Cezary Rojewski , Andy Shevchenko , Kai Vehmanen , Peter Ujfalusi , Takashi Iwai , Liam Girdwood , Ranjani Sridharan , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Theoretically the device might gone if its reference count drops to 0. This might be the case when we try to find the first physical node of the ACPI device. We need to keep reference to it until we get a result of the above mentioned call. Refactor the code to drop the reference count at the correct place. While at it, move to acpi_dev_put() as symmetrical call to the acpi_dev_get_first_match_dev(). Fixes: a232b96dcece ("ASoC: Intel: bytcr_rt5640: use HID translation util") Signed-off-by: Andy Shevchenko --- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index 4699ca79f3ea..79e0039c79a3 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -1636,13 +1636,18 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) if (adev) { snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name), "i2c-%s", acpi_dev_name(adev)); - put_device(&adev->dev); byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name; } else { dev_err(dev, "Error cannot find '%s' dev\n", mach->id); return -ENXIO; } + codec_dev = acpi_get_first_physical_node(adev); + acpi_dev_put(adev); + if (!codec_dev) + return -EPROBE_DEFER; + priv->codec_dev = get_device(codec_dev); + /* * swap SSP0 if bytcr is detected * (will be overridden if DMI quirk is detected) @@ -1717,11 +1722,6 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) byt_rt5640_quirk = quirk_override; } - codec_dev = acpi_get_first_physical_node(adev); - if (!codec_dev) - return -EPROBE_DEFER; - priv->codec_dev = get_device(codec_dev); - if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2) { acpi_dev_add_driver_gpios(ACPI_COMPANION(priv->codec_dev), byt_rt5640_hp_elitepad_1000g2_gpios); From patchwork Mon Jan 2 20:30:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13086994 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 458F4C3DA7A for ; Mon, 2 Jan 2023 20:32:06 +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 795A9A8D5; Mon, 2 Jan 2023 21:31:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 795A9A8D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1672691524; bh=jaaT5T3K18xgkyMdPptdmWzbRbrNy2o8GnbiBUb2YQg=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=bvPQQike/fSFss0Kvr0ypVNEE/ZqUjMP77JQg9f2jQIlY4GUdEItUBlBRu2umIkHn fUT5ogPq+l7k7dNbN2zlevTiiaxB1nFCOW2C+o48r4KzD/RwAzuXnJIFc+pOZFmcb1 lZ1FXJ00o39PfPF5G2IHmZiaC/PpcE8pfddfO4Zk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3607EF80553; Mon, 2 Jan 2023 21:30:07 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D5733F80543; Mon, 2 Jan 2023 21:30:03 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 859AFF8023B for ; Mon, 2 Jan 2023 21:29:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 859AFF8023B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ENurfOcr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672691397; x=1704227397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jaaT5T3K18xgkyMdPptdmWzbRbrNy2o8GnbiBUb2YQg=; b=ENurfOcru7dBruveAHCI8/pgrE20QnXAWJ7+lTGVuTIkpMSgaCIEA1Mp yDguvU9ge4MuroQR9MsjFmXC0R63R+2H3wlteZoLSiygqAG98k2H7qpFB vhHdAuKGgAR2WXl/t2xz7vSgL/kyIlM8p09c4g/G4056h3ZOUq7h6PyGw awuHBN+6zf7nVguYPUYvEND+NX+QAf1eCyHw2aLSDuEP5lqPG3/CtPaO3 FM05FcPAJJvQTmV5IEhzd8mrROIzXApsLrw0oNmLl7gnfxnN3UFTMRwsR wSGFcYEEsBUebA/fm934PWSUNYE1E/TCb35wAzl/B6pSkc8tfA4DgOnmX Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="321602423" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="321602423" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 12:29:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="717889962" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="717889962" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Jan 2023 12:29:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D6DAF1CA; Mon, 2 Jan 2023 22:30:16 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Vijendar Mukunda , Hans de Goede , Pierre-Louis Bossart , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 5/6] ASoC: Intel: bytcr_wm5102: Drop reference count of ACPI device after use Date: Mon, 2 Jan 2023 22:30:13 +0200 Message-Id: <20230102203014.16041-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> References: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Cezary Rojewski , Andy Shevchenko , Kai Vehmanen , Peter Ujfalusi , Takashi Iwai , Liam Girdwood , Ranjani Sridharan , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Theoretically the device might gone if its reference count drops to 0. This might be the case when we try to find the first physical node of the ACPI device. We need to keep reference to it until we get a result of the above mentioned call. Refactor the code to drop the reference count at the correct place. While at it, move to acpi_dev_put() as symmetrical call to the acpi_dev_get_first_match_dev(). Fixes: 9a87fc1e0619 ("ASoC: Intel: bytcr_wm5102: Add machine driver for BYT/WM5102") Signed-off-by: Andy Shevchenko --- sound/soc/intel/boards/bytcr_wm5102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c index 1669eb3bd80f..c0706537f673 100644 --- a/sound/soc/intel/boards/bytcr_wm5102.c +++ b/sound/soc/intel/boards/bytcr_wm5102.c @@ -411,9 +411,9 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) return -ENOENT; } snprintf(codec_name, sizeof(codec_name), "spi-%s", acpi_dev_name(adev)); - put_device(&adev->dev); codec_dev = bus_find_device_by_name(&spi_bus_type, NULL, codec_name); + acpi_dev_put(adev); if (!codec_dev) return -EPROBE_DEFER; From patchwork Mon Jan 2 20:30:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13086993 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 57D67C3DA7A for ; Mon, 2 Jan 2023 20:31:55 +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 8FEF3A8CF; Mon, 2 Jan 2023 21:31:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8FEF3A8CF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1672691513; bh=LwgfX1nuvuxjaGMvY2eRkuLAJY23wtVpSS451UENzDA=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=gJqW7j8OGR/0Fz3Y0uuygrObXv0MheuB9hPS+W/6I8zBi7LEdn7K3uRo4s2tdJEUh HRTi4R1dby6+a1mQPtIhdvPCKk4UUAzE/E5G3FQ09I5rmXPllhhVGv+Kc8C0J8nG3N 6etKoPv7G3ri5Z4ctOsSccHBcc9uvleh6Vtqz7n0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ABC12F80551; Mon, 2 Jan 2023 21:30:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E090EF8053C; Mon, 2 Jan 2023 21:30:02 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 972DFF8032D for ; Mon, 2 Jan 2023 21:29:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 972DFF8032D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JR1K/6m5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672691397; x=1704227397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LwgfX1nuvuxjaGMvY2eRkuLAJY23wtVpSS451UENzDA=; b=JR1K/6m5dN94BjsSbxOEiHpPwcywEGA5gpeBNEXfwKFB/zGgnRIZWVh3 KqGvGuF/WJz4wnuoiOYvwfS3fZz7DDPC4mtHJi2giA1EZJ0ghfThNIfew INu+HSxCzseFLfzsPc5Yz0zWWZJqJARyhcvXZOoWfucSXaT+oDWV2N0Nq QSH95f09PsM9iCsufAHFgV2KCFkZS9+/NCJwwBE+V9pysO3qgGBDjnYOA K55He6UZipQGwDgqg3/fraO5t8RbbLiiTEjUn4dBJkkMnhHj7dTniA9Tn 0WPSnsY0DkmrzKvVpmI3t4dy+8GYQ2HQrbR4PKMSZdsWoZymR59v0dzZ2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="320252201" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="320252201" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 12:29:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="685170321" X-IronPort-AV: E=Sophos;i="5.96,295,1665471600"; d="scan'208";a="685170321" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 02 Jan 2023 12:29:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E10DD220; Mon, 2 Jan 2023 22:30:16 +0200 (EET) From: Andy Shevchenko To: Mark Brown , Vijendar Mukunda , Hans de Goede , Pierre-Louis Bossart , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 6/6] ASoC: Intel: sof_es8336: Drop reference count of ACPI device after use Date: Mon, 2 Jan 2023 22:30:14 +0200 Message-Id: <20230102203014.16041-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> References: <20230102203014.16041-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Cezary Rojewski , Andy Shevchenko , Kai Vehmanen , Peter Ujfalusi , Takashi Iwai , Liam Girdwood , Ranjani Sridharan , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Theoretically the device might gone if its reference count drops to 0. This might be the case when we try to find the first physical node of the ACPI device. We need to keep reference to it until we get a result of the above mentioned call. Refactor the code to drop the reference count at the correct place. While at it, move to acpi_dev_put() as symmetrical call to the acpi_dev_get_first_match_dev(). Fixes: a164137ce91a ("ASoC: Intel: add machine driver for SOF+ES8336") Signed-off-by: Andy Shevchenko --- sound/soc/intel/boards/sof_es8336.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c index 773e5d1d87d4..894b6610b9e2 100644 --- a/sound/soc/intel/boards/sof_es8336.c +++ b/sound/soc/intel/boards/sof_es8336.c @@ -681,7 +681,6 @@ static int sof_es8336_probe(struct platform_device *pdev) if (adev) { snprintf(codec_name, sizeof(codec_name), "i2c-%s", acpi_dev_name(adev)); - put_device(&adev->dev); dai_links[0].codecs->name = codec_name; /* also fixup codec dai name if relevant */ @@ -692,16 +691,19 @@ static int sof_es8336_probe(struct platform_device *pdev) return -ENXIO; } - ret = snd_soc_fixup_dai_links_platform_name(&sof_es8336_card, - mach->mach_params.platform); - if (ret) - return ret; - codec_dev = acpi_get_first_physical_node(adev); + acpi_dev_put(adev); if (!codec_dev) return -EPROBE_DEFER; priv->codec_dev = get_device(codec_dev); + ret = snd_soc_fixup_dai_links_platform_name(&sof_es8336_card, + mach->mach_params.platform); + if (ret) { + put_device(codec_dev); + return ret; + } + if (quirk & SOF_ES8336_JD_INVERTED) props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");