From patchwork Fri May 12 10:33:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 13239107 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 9D666C77B7F for ; Fri, 12 May 2023 10:34:47 +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 13C3F1E4; Fri, 12 May 2023 12:33:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 13C3F1E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1683887685; bh=euyizZbQflA1FN/EBLxWYBuSUiyR+A6oIRnqD0hmsTM=; 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=M4XjxIRKphSDv5Te8WzmK2JkyD7pjnTLa8QTCc5SjYyzaf1cwNIvse0s46wbR3al4 47DEbpy/qtvCtLHlow4HU+6CrmsE+PilyigGuxTHMmgA2tzCflmzTY8THTiCiMrr/V WjUiKUjtSzKOQ4hMKY0PNGNu9H7wLeP3/KRHm+KI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1FC76F8056F; Fri, 12 May 2023 12:32: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 57D5CF8057C; Fri, 12 May 2023 12:32:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EB760F8053D; Fri, 12 May 2023 12:32:40 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 97308F802E8 for ; Fri, 12 May 2023 12:32:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 97308F802E8 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=f5zOpCix DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683887554; x=1715423554; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=euyizZbQflA1FN/EBLxWYBuSUiyR+A6oIRnqD0hmsTM=; b=f5zOpCixWWwad3el6Rn2o1NFTPs5djb5LcbHdbMLk6B9jkgNIOW0mD/f xxrhbiCC8oekI7xMSyI4kEH9ulhYMxEb5avn5AhC7Mg06PdwALTMCsMK6 I2BeMQ1PQ0/qzgwV9Nqx0ExvDUZoj49O4h/mnQ/Oa+xO9kB1TfERKNrG6 fK9feqFL7oY+Rei89+H7rBxnO+b1ekOs3I3SUBb4S11fU5fWe6In8SnOv AkpcmZpiRyuDiYal6lvlor2C1ck8VodcSvM9SrlkidmfL+SbABpKoMRh8 KRqSoTQykiJn+QVOenaTD6Ku3SfmyIPUbyWq1IrXkK6DjZN1XtANGRB4A w==; X-IronPort-AV: E=McAfee;i="6600,9927,10707"; a="416390495" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="416390495" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2023 03:32:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10707"; a="730774141" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="730774141" Received: from nhanph1x-mobl.amr.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.249.38.84]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2023 03:32:29 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, daniel.baluta@nxp.com Subject: [PATCH 3/3] ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error handling Date: Fri, 12 May 2023 13:33:15 +0300 Message-Id: <20230512103315.8921-4-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230512103315.8921-1-peter.ujfalusi@linux.intel.com> References: <20230512103315.8921-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: YOKEJFQQEUFFR4HY6TJYLJAQ7IKKMISK X-Message-ID-Hash: YOKEJFQQEUFFR4HY6TJYLJAQ7IKKMISK X-MailFrom: peter.ujfalusi@linux.intel.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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: From: Pierre-Louis Bossart When an error occurs, we need to make sure the device can pm_runtime suspend instead of keeping it active. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Daniel Baluta Reviewed-by: Ranjani Sridharan Signed-off-by: Peter Ujfalusi --- sound/soc/sof/sof-client-probes.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c index fff126808bc0..8d9e9d5f40e4 100644 --- a/sound/soc/sof/sof-client-probes.c +++ b/sound/soc/sof/sof-client-probes.c @@ -218,12 +218,7 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to, ret = ipc->points_info(cdev, &desc, &num_desc); if (ret < 0) - goto exit; - - pm_runtime_mark_last_busy(dev); - err = pm_runtime_put_autosuspend(dev); - if (err < 0) - dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err); + goto pm_error; for (i = 0; i < num_desc; i++) { offset = strlen(buf); @@ -241,6 +236,13 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to, ret = simple_read_from_buffer(to, count, ppos, buf, strlen(buf)); kfree(desc); + +pm_error: + pm_runtime_mark_last_busy(dev); + err = pm_runtime_put_autosuspend(dev); + if (err < 0) + dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err); + exit: kfree(buf); return ret;