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: 638437 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);