From patchwork Thu Jun 16 22:29:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 582236 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 CE038C43334 for ; Thu, 16 Jun 2022 22:31:08 +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 ACF151B09; Fri, 17 Jun 2022 00:30:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ACF151B09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1655418667; bh=Kw+OdvwAvffqIiIFyzfvVRX8uYzhXxCqjC3UVyYGkD8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jlF4VZzhjUszuu9a2eSu1lBCZ99mMI2gPnTtqRnIQ5qA/+GqnhXywpgp2m1XFxgGk lYAyzUdYh11Dv8cIHnRZjPLXKI/2B3QkpCP+epfegzWzLLs/KhDy/A1BlnIuBj7zCx xs5+NZajuyLEQl36OVR9RqqMHxNPVQlkxDgN3xTU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AD5CCF8052E; Fri, 17 Jun 2022 00:29:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 346F5F80527; Fri, 17 Jun 2022 00:29:34 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 DD921F801D8 for ; Fri, 17 Jun 2022 00:29:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DD921F801D8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GZf+xJtJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655418569; x=1686954569; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kw+OdvwAvffqIiIFyzfvVRX8uYzhXxCqjC3UVyYGkD8=; b=GZf+xJtJTln/YJ0NtihjgvtjPDoj+98iSxqUkqlMEvVYqRVaD1VT7jLB 1wsVgKaPzZtfTLaEB/D+r80mOkb00CXCaJP7psmjUVfMnmcLKSoGDKATb R6em9mxquViGXPb/IeyDr2o+nan1F/kWvjVuEhRfr4YuC+8ixxmpGTLl4 hsa0ekLHQLIZkXzzFxJ/EU4Oky8BhyewY099FCxZnfgk9KO6zv5EVNyKp ChrsRcQzkf04t6TNaApvXKCRIvFcavSB6svgqdHrWRNRz7ftqclH0hoXl GiMIKZKcJ/ziofY18K572q/pavlvmh1yPy+neK6dKg/rbHLxCfobrWcNu Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="365718821" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="365718821" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 15:29:21 -0700 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="653359638" Received: from buckkenx-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.52.70]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 15:29:20 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 2/2] ALSA: x86: intel_hdmi_audio: use pm_runtime_resume_and_get() Date: Thu, 16 Jun 2022 17:29:10 -0500 Message-Id: <20220616222910.136854-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220616222910.136854-1-pierre-louis.bossart@linux.intel.com> References: <20220616222910.136854-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Kai Vehmanen , tiwai@suse.de, Pierre-Louis Bossart , Ranjani Sridharan , Hans de Goede , broonie@kernel.org, Bard Liao 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" The current code does not check for errors and does not release the reference on errors. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Kai Vehmanen Reviewed-by: Ranjani Sridharan --- sound/x86/intel_hdmi_audio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index 3b04c70a73e33..ab95fb34a6358 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c @@ -1068,7 +1068,9 @@ static int had_pcm_open(struct snd_pcm_substream *substream) intelhaddata = snd_pcm_substream_chip(substream); runtime = substream->runtime; - pm_runtime_get_sync(intelhaddata->dev); + retval = pm_runtime_resume_and_get(intelhaddata->dev); + if (retval < 0) + return retval; /* set the runtime hw parameter with local snd_pcm_hardware struct */ runtime->hw = had_pcm_hardware; @@ -1536,8 +1538,12 @@ static void had_audio_wq(struct work_struct *work) container_of(work, struct snd_intelhad, hdmi_audio_wq); struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data; struct intel_hdmi_lpe_audio_port_pdata *ppdata = &pdata->port[ctx->port]; + int ret; + + ret = pm_runtime_resume_and_get(ctx->dev); + if (ret < 0) + return; - pm_runtime_get_sync(ctx->dev); mutex_lock(&ctx->mutex); if (ppdata->pipe < 0) { dev_dbg(ctx->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG : port = %d\n",