Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2920896pxb; Tue, 24 Aug 2021 10:38:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYAD/F/UcrASWBtPk31HDxd4ZVRFyd+nNXi3kMCieJGECZFJqDyUycsrRIdZpH3CejMo/I X-Received: by 2002:a92:730d:: with SMTP id o13mr27579063ilc.183.1629826689897; Tue, 24 Aug 2021 10:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826689; cv=none; d=google.com; s=arc-20160816; b=qSLOypjmudS1a2M+G6exfMqWEeGUAfyC7Q8EScabsIVGskC4K+IMEvfwdxroSdgbtN vBVDAO2gLcCewiTNpWfCnWUIuFf2m1BFhnnKiHjf1QOXsd/dzPHJ0CNBumO9tUMx+IQG c17IO7MLuds2sRy2jrGezStzMW9dgQHsINtp1yWGfNLlJsmdUM8iovs5yhnfrUiUoLQ3 EOzK/T++reqkgDy5rYVgIVoGs3WhHBciS5u8gdbXVaWr/nzJsIUf1pswQf6qz9ArJRuC RgdjhdJmT1GLx9ixyaiA1zrIiHJIo8dal3AYopVXHTChhhauZs5z/jPda82UxmJXR/Cs 4NsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tDzU95j6Jtj0WHxQFPQ04a4L2tazXcxDL2UyDERKOZc=; b=z7/oAse3HRkHo1F65FeKyIz0xeRuGQLWtgNcs8Uu34haxK3D02sLSJMYl+h6z1eFpL JPX1Ue8+q/+eRJtn+QubpSfbTDPYyWiHMqJr/sODX4R2EyG9mdsuwtMZp5KWKLDZ8xoH 8KaDuRaVVg3d0RVJ9R+r7l1ZDzZ0aKomJgM/dKFoLS7xDlRd1WisoGLbSgfWR6Whb2/m jXOrF8QBFK+Ypci4WuM+RaHbUqYSqJrr1esw4d5BD3f32xm0cfkAo/56qC3Xft+VLggC RF31TbFzZHcaskdy9oWrmS3AK7skvgI+Haaf/DsULZSZ6Y94/s4qKhb0toIbAqWvpQkn onGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YrRKgC6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si17524039jam.20.2021.08.24.10.37.58; Tue, 24 Aug 2021 10:38:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YrRKgC6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241621AbhHXRgh (ORCPT + 99 others); Tue, 24 Aug 2021 13:36:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:40664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241550AbhHXRdE (ORCPT ); Tue, 24 Aug 2021 13:33:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06AA6617E6; Tue, 24 Aug 2021 17:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824778; bh=0wt2/bJt7y1q3MqYQhZwfusAFLFPDCe3IIccScGZUhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YrRKgC6Fgg31/QP2m+fl+d+jjH3AcB34ypmMmevls4DmiutmxRLgzUHBemxfr3/Ot 03E06kENarcikMA8gqAsla94oj2ol820qU2m+f2HKrbWtvbFUu5Gee6cnEkjAhHNfj ge5xBIKl5s7w0Y7KebyAtkI9aIV/5hX790F7jWuXzPMeOdVWnka+xF78jQFXJt+Lzz IeQovcXfzKgm5zf8oG+KXoyNMkTAbogEL7p6hp21dbbpOsF4KqLdEuIeTWXol6j5Dh UrJeltw9UqD+1wIViCA7JoT2uh9vDHdixT5XKjUyLgIVZ7ZqIeEzs/zDjUjliDIKY3 2WkUt/TfgLmZA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai , Cezary Rojewski , Pierre-Louis Bossart , Mark Brown , Greg Kroah-Hartman Subject: [PATCH 4.9 02/43] ASoC: intel: atom: Fix reference to PCM buffer address Date: Tue, 24 Aug 2021 13:05:33 -0400 Message-Id: <20210824170614.710813-3-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170614.710813-1-sashal@kernel.org> References: <20210824170614.710813-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.281-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.9.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.9.281-rc1 X-KernelTest-Deadline: 2021-08-26T17:06+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 2e6b836312a477d647a7920b56810a5a25f6c856 upstream. 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 Link: https://lore.kernel.org/r/20210728112353.6675-3-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- 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 d812cbf41b94..6303b2d3982d 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -135,7 +135,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; @@ -241,7 +241,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; -- 2.30.2