Received: by 10.223.164.202 with SMTP id h10csp964888wrb; Thu, 23 Nov 2017 09:00:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMbR3mHilKMxU15+HWJzc0qaOyEyy82ZHCfeqE4xs/cPfktFXlfphPy5QpBW5KHscysAtYdB X-Received: by 10.98.100.71 with SMTP id y68mr23770723pfb.178.1511456435528; Thu, 23 Nov 2017 09:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511456435; cv=none; d=google.com; s=arc-20160816; b=clpqam2ajUM3VqDAYv1iXlTePAMrh24FrKcCFL6+BBqxgfFo2Vb3MEB8fqPowcDDy/ iB/11mX9L8UBGcr6q71Lyd0adKiSTUviR/BuSvHVuMjPhTmZqqLGJXv1nRYwpgGztmT0 Dec28+UsCYicU/SGyC/SI2k+v2dZkpouVjoMttNOrW/CrpQn9jYXaY8xlDTrH1/DQwcg JMc2XcpoUh/3hH7WP7ydPbKTqVhMLYV3IxiojjW1jmdnHuANZZGAj09JSuKWUUBe1uOM lfJZaBHbPiiG7iruMeEQW4vfM1nmh0g5J5JxwAQaQVpbH48YrEsGL0K77PnbdFzfSW3w C8Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=cPfFqWfrEMQesyUx+yZNY32172V+FAaB0Kbi+qpa10g=; b=PYMthGXZQmbToEBYgg7eJS8uxxR20+uK5SFdlSbW0g49a8PgMde08UKmYkX3Wm+8uB puTUUMav7jQ6eacARym6EKQMVV/i9p/ODS+OCUhOH0oOyASEuFrzPTQKgdRUd/jsUx9K gtaKzPp5V3tsGzHd8MHDIIlEBcadjWq9Jj8ESC0zyPKWGTV7/U7Cxd0gj5UjCAOe0aD3 HHVZkMauWB97IUq2CViA9zLybKOu1kW4AgKQuaHsPbbepe8muSTbjAsSBDTCwRyZr5Ic 67S79dchHEjM85x+5uLygKdVClP4pq33Yh2Do4rETRNnYEV/J6t6SRp0HZfhWmbMxvqN a1Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UZNcSaDT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si16532590pgc.21.2017.11.23.09.00.23; Thu, 23 Nov 2017 09:00:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UZNcSaDT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753126AbdKWQ7q (ORCPT + 76 others); Thu, 23 Nov 2017 11:59:46 -0500 Received: from mail-yb0-f195.google.com ([209.85.213.195]:36334 "EHLO mail-yb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753000AbdKWQ7p (ORCPT ); Thu, 23 Nov 2017 11:59:45 -0500 Received: by mail-yb0-f195.google.com with SMTP id s187so105432ybs.3 for ; Thu, 23 Nov 2017 08:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cPfFqWfrEMQesyUx+yZNY32172V+FAaB0Kbi+qpa10g=; b=UZNcSaDTecfhndZ9UNQqPB1EppL57a86WRblBxd8ASmWmSTM6b1QILLiK2ew2UFYZQ QvmNRkfZ7lO8rAa8unrA+4AzsU0TE9zp9SnKWk42HGvVJY8IeEgKNg/wrvlqj58ShKRV 4k7pcidCM65g4DvZcG0CqqlO4Q0mwQGHpSw5FIzhhpx6Eku5hTAYL6MxfUp8ZlpKkDoY lT5ZZN78MZl0NABG4iNprsIiNQgmG5Xc0RpRlfP0Xkenee48Z5OOw9UrEyhW2W2EhBFN 2fYXvrZzzhGJE35pa0PqJFQBI/5Dwu4ODO8uc0YzBnzjRMdTSQJ1OBLzUPDKGWBRhjio 2Mgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cPfFqWfrEMQesyUx+yZNY32172V+FAaB0Kbi+qpa10g=; b=q+NM+VCxXRa98SMfedXY7c57wPEZBL0W8+R2W+4b3+sxfut78jOkIWpmjRmWxBfPFF YumclkHNifkh5GK1RwPUvk/2X3VX9ZFDeMs1yadsJX9ZuI+ixsanFP0lZGrHEMRNKgB6 XD/qzAnfCAei74o2ishYhpBXfVVw//23c1sPhrqbc9tQTgxax51lDpAY+D6qazeTpOOp wp+NcPrcx1CGWJ+blByTi2sXU9toQ5Wwz2/oWO6Qz+Hd6/Chd2tn5n7KQ8wKpwZb5Esn BuOlMx51eyfe0e7pj+NBE4IOgqtfhz2f95d7KEWgecEaIralUMdtoWIvjMkqoXHbE8Lj PLwA== X-Gm-Message-State: AJaThX6zwoJ8T9O6lZE3LGKRlSr64XBDmuxr2Ey1ahY+b1ApkNa31ABF N54Z3jePonjPMTf9AUAtTwaSPxnFsILmqEzKC1qelw== X-Received: by 10.37.9.70 with SMTP id u6mr16588651ybm.442.1511456384389; Thu, 23 Nov 2017 08:59:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.87.6 with HTTP; Thu, 23 Nov 2017 08:59:43 -0800 (PST) In-Reply-To: <1511454602-7259-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1511454602-7259-1-git-send-email-Vijendar.Mukunda@amd.com> From: Guenter Roeck Date: Thu, 23 Nov 2017 08:59:43 -0800 Message-ID: Subject: Re: [PATCH] ASoC: amd: added error checks in dma driver To: Vijendar Mukunda Cc: Mark Brown , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , perex@perex.cz, Alex Deucher , Akshu.Agrawal@amd.com, Guenter Roeck , linux-kernel , Dominik Behr , Daniel Kurtz , Guenter Roeck Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 23, 2017 at 8:30 AM, Vijendar Mukunda wrote: > added error checks in acp dma driver > > Signed-off-by: Vijendar Mukunda > Signed-off-by: Akshu Agrawal > Signed-off-by: Guenter Roeck This is inappropriate. Guenter > --- > sound/soc/amd/acp-pcm-dma.c | 45 ++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 40 insertions(+), 5 deletions(-) > > diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c > index 17d76fa..804e659 100644 > --- a/sound/soc/amd/acp-pcm-dma.c > +++ b/sound/soc/amd/acp-pcm-dma.c > @@ -848,6 +848,9 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) > struct snd_pcm_runtime *runtime = substream->runtime; > struct audio_substream_data *rtd = runtime->private_data; > > + if (!rtd) > + return -EINVAL; > + > buffersize = frames_to_bytes(runtime, runtime->buffer_size); > bytescount = acp_get_byte_count(rtd->acp_mmio, substream->stream); > > @@ -873,6 +876,8 @@ static int acp_dma_prepare(struct snd_pcm_substream *substream) > struct snd_pcm_runtime *runtime = substream->runtime; > struct audio_substream_data *rtd = runtime->private_data; > > + if (!rtd) > + return -EINVAL; > if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { > config_acp_dma_channel(rtd->acp_mmio, SYSRAM_TO_ACP_CH_NUM, > PLAYBACK_START_DMA_DESCR_CH12, > @@ -1066,6 +1071,10 @@ static int acp_audio_probe(struct platform_device *pdev) > struct resource *res; > const u32 *pdata = pdev->dev.platform_data; > > + if (!pdata) { > + dev_err(&pdev->dev, "Missing platform data\n"); > + return -ENODEV; > + } > audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data), > GFP_KERNEL); > if (audio_drv_data == NULL) > @@ -1074,6 +1083,8 @@ static int acp_audio_probe(struct platform_device *pdev) > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > audio_drv_data->acp_mmio = devm_ioremap_resource(&pdev->dev, res); > > + if (IS_ERR(audio_drv_data->acp_mmio)) > + return PTR_ERR(audio_drv_data->acp_mmio); > /* The following members gets populated in device 'open' > * function. Till then interrupts are disabled in 'acp_init' > * and device doesn't generate any interrupts. > @@ -1099,7 +1110,11 @@ static int acp_audio_probe(struct platform_device *pdev) > dev_set_drvdata(&pdev->dev, audio_drv_data); > > /* Initialize the ACP */ > - acp_init(audio_drv_data->acp_mmio, audio_drv_data->asic_type); > + status = acp_init(audio_drv_data->acp_mmio, audio_drv_data->asic_type); > + if (status) { > + dev_err(&pdev->dev, "ACP Init failed\n"); > + return status; > + } > > status = snd_soc_register_platform(&pdev->dev, &acp_asoc_platform); > if (status != 0) { > @@ -1116,9 +1131,14 @@ static int acp_audio_probe(struct platform_device *pdev) > > static int acp_audio_remove(struct platform_device *pdev) > { > + int status; > struct audio_drv_data *adata = dev_get_drvdata(&pdev->dev); > > - acp_deinit(adata->acp_mmio); > + status = acp_deinit(adata->acp_mmio); > + if (status) { > + dev_err(&pdev->dev, "ACP Deinit failed\n"); > + return status; > + } > snd_soc_unregister_platform(&pdev->dev); > pm_runtime_disable(&pdev->dev); > > @@ -1128,9 +1148,14 @@ static int acp_audio_remove(struct platform_device *pdev) > static int acp_pcm_resume(struct device *dev) > { > u16 bank; > + int status; > struct audio_drv_data *adata = dev_get_drvdata(dev); > > - acp_init(adata->acp_mmio, adata->asic_type); > + status = acp_init(adata->acp_mmio, adata->asic_type); > + if (status) { > + dev_err(dev, "ACP Init failed\n"); > + return status; > + } > > if (adata->play_stream && adata->play_stream->runtime) { > /* For Stoney, Memory gating is disabled,i.e SRAM Banks > @@ -1162,18 +1187,28 @@ static int acp_pcm_resume(struct device *dev) > > static int acp_pcm_runtime_suspend(struct device *dev) > { > + int status; > struct audio_drv_data *adata = dev_get_drvdata(dev); > > - acp_deinit(adata->acp_mmio); > + status = acp_deinit(adata->acp_mmio); > + if (status) { > + dev_err(dev, "ACP Deinit failed\n"); > + return status; > + } > acp_reg_write(0, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); > return 0; > } > > static int acp_pcm_runtime_resume(struct device *dev) > { > + int status; > struct audio_drv_data *adata = dev_get_drvdata(dev); > > - acp_init(adata->acp_mmio, adata->asic_type); > + status = acp_init(adata->acp_mmio, adata->asic_type); > + if (status) { > + dev_err(dev, "ACP Init failed\n"); > + return status; > + } > acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); > return 0; > } > -- > 2.7.4 > From 1584853998505310579@xxx Thu Nov 23 10:55:53 +0000 2017 X-GM-THRID: 1584853998505310579 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread