From patchwork Wed Jul 28 11:23:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 489306 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F25DC432BE for ; Wed, 28 Jul 2021 11:23:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8A51600D1 for ; Wed, 28 Jul 2021 11:23:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234424AbhG1LX5 (ORCPT ); Wed, 28 Jul 2021 07:23:57 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:57830 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232530AbhG1LX4 (ORCPT ); Wed, 28 Jul 2021 07:23:56 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 83E691FF88; Wed, 28 Jul 2021 11:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1627471434; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uOLAxgFmuIdFVl8t9Q3JRIAsoz6GO4ZzUHxR55M5+qk=; b=jZjnFHSfstJWxgB0XrDp+UolP1Zm4spmkVhfrYreQk1Nim5It1dv0K5Qgpd3eHvZO1/+2e QdbFJcz4MjsOgOSqovgEMcjgavsBZNoDx3Mdibj141sARGvRGvRbtWqnDPuvk4RDoLNFWJ ub5jOIhiMZfFPsAhkNubYRheXlno5Ic= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1627471434; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uOLAxgFmuIdFVl8t9Q3JRIAsoz6GO4ZzUHxR55M5+qk=; b=lm+uiI0hpUG3lWwruUtGW3bJ/qKuuxB2gE/QMMuntYkAuOqbDGMChzula/mXoci1Yi/s+e UhGNr1bKPwxmq9Bw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 6E388A3B81; Wed, 28 Jul 2021 11:23:54 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Mark Brown , Cezary Rojewski , Pierre-Louis Bossart , stable@vger.kernel.org Subject: [PATCH 2/5] ASoC: intel: atom: Fix reference to PCM buffer address Date: Wed, 28 Jul 2021 13:23:50 +0200 Message-Id: <20210728112353.6675-3-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210728112353.6675-1-tiwai@suse.de> References: <20210728112353.6675-1-tiwai@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org PCM buffers might be allocated dynamically when the buffer preallocation failed or a larger buffer is requested, and it's not guaranteed that substream->dma_buffer points to the actually used buffer. The address should be retrieved from runtime->dma_addr, instead of substream->dma_buffer (and shouldn't use virt_to_phys). Also, remove the line overriding runtime->dma_area superfluously, which was already set up at the PCM buffer allocation. Cc: Cezary Rojewski Cc: Pierre-Louis Bossart Cc: Signed-off-by: Takashi Iwai Reviewed-by: Cezary Rojewski --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 4124aa2fc247..5db2f4865bbb 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream, snd_pcm_uframes_t period_size; ssize_t periodbytes; ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream); - u32 buffer_addr = virt_to_phys(substream->dma_buffer.area); + u32 buffer_addr = substream->runtime->dma_addr; channels = substream->runtime->channels; period_size = substream->runtime->period_size; @@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream, /* set codec params and inform SST driver the same */ sst_fill_pcm_params(substream, ¶m); sst_fill_alloc_params(substream, &alloc_params); - substream->runtime->dma_area = substream->dma_buffer.area; str_params.sparams = param; str_params.aparams = alloc_params; str_params.codec = SST_CODEC_TYPE_PCM;