From patchwork Mon Dec 4 15:16:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 10090643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C3D9F60327 for ; Mon, 4 Dec 2017 15:16:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA1002912E for ; Mon, 4 Dec 2017 15:16:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE95A29132; Mon, 4 Dec 2017 15:16:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB76F2912E for ; Mon, 4 Dec 2017 15:16:00 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EB82B266D55; Mon, 4 Dec 2017 16:15:58 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 07559266E57; Mon, 4 Dec 2017 16:15:58 +0100 (CET) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0067.outbound.protection.outlook.com [104.47.42.67]) by alsa0.perex.cz (Postfix) with ESMTP id 17776266BBC for ; Mon, 4 Dec 2017 16:15:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nKnRXJRrM6MFBOZN0sEhD+9DuUkbRBUzGbB/8mhDEcY=; b=pWLMR4bGzD9EhLQulC/THwjZOgFxGnCuH47maKXmssTpfHXAS1TqXiMikuMguCB1B9IveGYCnP1bRMUwH4MPwz5wsDFuA4kZcF85Qb8vzSTJa+n3Kcg/50l0cMm6sVE36A9cjUHaPKZiETUE/bdEbypEzfRlV1vG76vBybL3kuY= Received: from MWHPR12CA0050.namprd12.prod.outlook.com (10.175.47.140) by DM5PR1201MB0060.namprd12.prod.outlook.com (10.174.106.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Mon, 4 Dec 2017 15:15:51 +0000 Received: from BY2NAM03FT025.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::206) by MWHPR12CA0050.outlook.office365.com (2603:10b6:300:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Mon, 4 Dec 2017 15:15:51 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by BY2NAM03FT025.mail.protection.outlook.com (10.152.84.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.282.5 via Frontend Transport; Mon, 4 Dec 2017 15:15:50 +0000 Received: from SATLEXDAG04.amd.com (10.181.40.9) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 4 Dec 2017 09:15:49 -0600 Received: from SCYBEXDAG03.amd.com (10.34.11.13) by satlexdag04.amd.com (10.181.40.9) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 4 Dec 2017 10:15:49 -0500 Received: from LinuxHost.amd.com (10.129.12.246) by SCYBEXDAG03.amd.com (10.34.11.13) with Microsoft SMTP Server id 14.3.361.1; Mon, 4 Dec 2017 23:15:45 +0800 From: Vijendar Mukunda To: , Date: Mon, 4 Dec 2017 20:46:24 +0530 Message-ID: <1512400584-28170-1-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(376002)(39860400002)(346002)(2980300002)(428002)(199003)(189002)(50226002)(68736007)(81156014)(105586002)(101416001)(8676002)(110136005)(106466001)(16586007)(316002)(81166006)(54906003)(189998001)(2906002)(305945005)(53936002)(8936002)(356003)(47776003)(36756003)(50466002)(7696005)(48376002)(4326008)(97736004)(51416003)(39060400002)(77096006)(5660300001)(72206003)(478600001)(86362001)(6666003)(53416004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0060; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT025; 1:no1hwBKY2opT0487pih6OmtwCgQqksNN4mT9Qdk3H07fB96Ak4v+ivyOVdNua1melFoRZ9TzArYGn5zGvU6bcRw4MZKm4dC/6TLIziWu2c/iQdrF2zqHiyDrmRQQkgCl X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa5cb2c7-a116-429d-05ee-08d53b29e7a6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603286); SRVR:DM5PR1201MB0060; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0060; 3:vQTvqd0c9zDwISvnEnb3gSP+IPf6JM77JnprFrpK4TIo+vfG8u8msWa79+gPnCtqctirr+ert/5YIdq3kJmrJSUmAVmu1LYrhhYG9o+QcCez6b/M6xeFkxEG+xlZNJJAYcEsscJ10wSd0C6LmgjVmV9QptZqo6ko2mxUYEJO0jRuexLSQ5vhEfYjRoCWIdaexCIHeamVI1xKtylnMu+2KlDdWWaqo8795+CbIFxjvzX3aeBz00VGH3Di2EMd756Ycupe7FFE0RcFshLjnpvyFk8oaoUmJsZbXtjU7JIlPir8s/Hve+cfY4lrkEKRwa7cz20Ct+eJVh/UAY65TpY2pTEQb3m8IOLPebC6k4RD5XQ=; 25:OtgHYDwd99qYMn0CiGm3cHQld9HgXPvXX5DVLvY2bLhlW6xmBsNxyGbsLuc1HoCCw/Zpusje4afNI89frIs+iKG/f07q6e6f6D+KQEHBBmQ4cMX+/kEWXJ1FuK100SKW7oG588cJMe8Llgt4693WD9vZ9Iu9vYR94kkIwxC2yitDYb2oRlErYs8I+pXZaGFMcGFGFOjsmbTPB/vpaz6oQ7crCCXcuo+bCpD24JG6c9Tbtf635MEijYv4n2UFDSduSDpWxoLIVj2sXfPqBqT/Aa/hRaPO7m4nB2uecFixTvgEqYGU4FHEF4zkXq6TIyldQr6Ch+wM/XJ9HM6JglAMfw== X-MS-TrafficTypeDiagnostic: DM5PR1201MB0060: X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0060; 31:syhXNpfSYWPs0PLukA1iGp9SLd55xJCa/zL1cmbYMjKzHceUpUkku11k3amgmc/H3l5SClK5AprbSeUhoc3SLKUq9Xga6mSDOLiw0CkAF2OqI/PoRpK+AXyDtnIpxd8Y/z69bGX8M30Pe9EZZfLEmG0u7Ls1gWqa0Ws71WrVENytCaV5ZNinsNH2kXQ6JaYSBNqkYVT5zb8+RvTw46c6RNlsbiMkt+D3JQdOKa7GiFA=; 20:oyhfseKL1fbJbhGsrRZiX/hBJ5QUHT6UCpQRxHEo8MATpqtFZnrkfQNOJ6nNAvXry/KfupukWYLfvckbEBbhESeBHg/82stm1Ol5yEhFwc2m3mvF1AVUluU5Y5jMfiwDRweE4Z5yTZWyR0NXjAQbQX7UiLm653FViaopTegJRDfYuB0eUSTrjHia8CyVYCVbwlqLeKlrksjhZH2PGqMstEAVRtAayhAP3QD9+KUppBbsw0jyKIDLGajidQce8ijkTalAd3ko7kzNS5/5kIvefkJkHL7qnmHdp0CxkFfBLKAi57uXjN/qemR3aJkVXOcac0ZSrBV5oHd1P4jBqKorForGH6bpTwVUiZZzVrAh/QPeua+x+NleRx4eCQQBO8C8/8cqYrsKK0gOROrdlyPlJUHK++Pp0Mj9koj98LzpxWyQsGyO5y08K6pfc1Ptgyqn4ZJYMIyJNp5APZF7fCfjuPfxRXu80RhjCnZHeiBQx0yR7TJ7XEvthlQxFfjtcM/Y X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93003095)(3002001)(10201501046)(3231022)(6055026)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123560025)(20161123562025)(6072148)(201708071742011); SRVR:DM5PR1201MB0060; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR1201MB0060; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0060; 4:zb3bEzvHUr8rc8dNP7ni47nIBMk1upUJsKHLaYvYwl9UgzFOwvdFd0NeKE7B5Jl2jEbFW2fvUmzURf3D1cljgZDgFqw3y77Ci7dsxcnKdPHH7sBbCGoEmuqp281ZGmXmEng80E0xkzQA4vpbmZJJ0eRn9xRtHrmwhpyEMh2g3BYYLxZ9/FuqfXeO+SGMY6PQJYSl6PbIZm7t41UInoG8X4XDO7kDKSNt9NZiH9gkE1yTN0n+OMZYfMXDnBN3TAlqmp6XpocifDY6e6TMfw/ANH7ZgV6lup7Fhhn5ccaR8KTLkKCUxNp0MbzU5Y9Z6PGt X-Forefront-PRVS: 051158ECBB X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0060; 23:Ikl2J8syVwKD2LpCffoON4CfY+DtWI/8zrxjJ6S?= =?us-ascii?Q?YcI8CUkTP8IRQwWDyfABoR0YBuyqUMY93CIQV1JKrOg5m4Ltkw4TynLJInYY?= =?us-ascii?Q?aRs/UQMbgC0lUq/0wGnnGeiyTqq9tDrWlDU55xdhgHIKA0VTl7E3nYTbbK9s?= =?us-ascii?Q?yKnN9QDyniMGgr0UbEaYbGynkewPilkjHt0iJYmdK+lhiyK7HK9b/syGTdf2?= =?us-ascii?Q?EYdHY0gnwwJcUOgcS37txoMTA9m8eJVIJiBKnd8UFbGNJi8PRWNIy49SXBeM?= =?us-ascii?Q?o/Irs8VY2pYbUkY5o0tEOglZkrBNWrDU3mN0skOsg5NHgQbj49K94x6eQbat?= =?us-ascii?Q?Qj/2GOrvw+DDRedi8CTQ1aXiyHi/zp0LyZAVJmu7DlMV2LNHzir8iUmBuLgB?= =?us-ascii?Q?u+F3Sn2JSmPwPOZlmR0VL1PCXCkf0FfBXHRAArI9hmMXfxtT38WeCfjmhhGF?= =?us-ascii?Q?5cgC5lbvvDRTlct5+FfDhFzYAww9b1M3/O/NOI7GuDiMaDivJvGq5JaTDTlH?= =?us-ascii?Q?Gy8x9FMVrtMiHmrFWY4teeoqK0jM6loin/8Invdpp+/1+IVwptE0HC8+kgC7?= =?us-ascii?Q?dXgeJcZEwNy+paRBHsZoWanGFE0kNWQyy1tZaxasUVcGsmfsmRTny62kUu2W?= =?us-ascii?Q?xONb4x82RJGfW4SgvHc0Wv82bKkz+zx8Eun7tDDodIoBZZIVCSAfM4ob6pbo?= =?us-ascii?Q?I+oiF1scv4gSgwjHFq0EBXPlEqDUObsNwTZpiDIkgHCD1hsP7mf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B27hua7gtkfeb/XYwX+sEZ2jFxOlmHO0DcbzrILPNFSFnVBVx8jcGXTgX35l08McwK6Rarhtm82QVyMQLLX6lipe/I9p+vP3KkkvtDeyKYRocmgE9A4Y5F7jnbbV5h+g/1U614mdATQohQ8UwpfyF4a+pyNxNKNHLo7kiPN7GE2zQgC4SO/335kVu3P5+F7N2pQhSF9xQi2xvSaxFjzqUilM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0060; 20:/GEGlKxVtiE3IOyrq5SGN6r/V5M+CRsqP1sYiBL/1wSawq8ShQbWettnzeX2c9ZX1hC/FB96heXPnRAtRID4l4hNkGGGeddTNbIGLl3sSn4M0WdXqNbENgukLGIrAEmOOM0M9dHngkn1//Cx1yVnh23qoDjoabAOkR2JSftFiBDOJa5RudvbD/RBXMCo+R4Zp6HSj1xLDMiZG69GD9SdXMMz6Qy9meVd7DwO/PBVl9UsCxSOkfzd5ezVIVvX6XK4 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 15:15:50.7345 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa5cb2c7-a116-429d-05ee-08d53b29e7a6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0060 Cc: tiwai@suse.de, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, Vijendar Mukunda , Alexander.Deucher@amd.com Subject: [alsa-devel] [PATCH] ASoC: amd: added error checks in dma driver X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP added additional error checks in acp dma driver v2: printed error codes for acp init & acp deinit failure cases. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp-pcm-dma.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index fb09578..29be517 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, @@ -1082,7 +1087,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 status:%d\n", status); + return status; + } status = snd_soc_register_platform(&pdev->dev, &acp_asoc_platform); if (status != 0) { @@ -1099,9 +1108,12 @@ 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 status:%d\n", status); snd_soc_unregister_platform(&pdev->dev); pm_runtime_disable(&pdev->dev); @@ -1111,9 +1123,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 status:%d\n", status); + return status; + } if (adata->play_stream && adata->play_stream->runtime) { /* For Stoney, Memory gating is disabled,i.e SRAM Banks @@ -1145,18 +1162,26 @@ 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 status:%d\n", 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 status:%d\n", status); + return status; + } acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); return 0; }