From patchwork Thu May 22 10:10:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 4221411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 452559F23C for ; Thu, 22 May 2014 10:15:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61398201ED for ; Thu, 22 May 2014 10:15:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D50E201C8 for ; Thu, 22 May 2014 10:15:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnPyq-0001sK-Tt; Thu, 22 May 2014 10:12:08 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnPyn-0001qm-AG for linux-arm-kernel@lists.infradead.org; Thu, 22 May 2014 10:12:06 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5Z004040B9TA20@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 22 May 2014 19:11:33 +0900 (KST) X-AuditID: cbfee61b-b7fbb6d000001be3-f0-537dcd55c708 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 8D.4A.07139.55DCD735; Thu, 22 May 2014 19:11:33 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5Z00HZW0A9M880@mmp2.samsung.com>; Thu, 22 May 2014 19:11:33 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Subject: [PATCH] ASoC: samsung: Handle errors when getting the op_clk clock Date: Thu, 22 May 2014 12:10:52 +0200 Message-id: <1400753452-6943-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPJMWRmVeSWpSXmKPExsVy+t9jQd3Qs7XBBs++illcuXiIyWLqwyds FpseX2O1mHF+H5PF4TftrA6sHhs+N7F5bFrVyeaxeUm9R9+WVYwenzfJBbBGcdmkpOZklqUW 6dslcGXsPr6VreA9R8X6o9dYGxgnsncxcnJICJhITJnZxAZhi0lcuLceyObiEBKYzihx4ks3 C4TTwSTxcvFasCo2AUOJ3qN9jCC2CFDH7TmdzCBFzAIzGSUmre4CGsvBISzgLXH0dw1IDYuA qsTKa0vAwrwCrhLbNkSCmBICChJzJtlMYORewMiwilE0tSC5oDgpPddIrzgxt7g0L10vOT93 EyM4GJ5J72Bc1WBxiFGAg1GJh/fG+ZpgIdbEsuLK3EOMEhzMSiK8QYdrg4V4UxIrq1KL8uOL SnNSiw8xSnOwKInzHmy1DhQSSE8sSc1OTS1ILYLJMnFwSjUwrj2/Nrmro93V4+3zl/8MJ5mJ SF/2jtLj5V/suPHkw68FLDP55Cqabtf88lvQbFQ4I/hz3+SF8R9fzOQ8ndP6rjzfcyFrkrXD e/8OY6viY3e6p7zZrn3q8q45iZX7a2xjVszakPKIK+/BlOW7Ut6VyYtw+Ufdr3g9r+vyhBnS 2yJ1Y40rWlR3KrEUZyQaajEXFScCADaEPFUCAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140522_031205_537433_4AA71F13 X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.7 (-----) Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure i2s->op_clk is not used when clk_get() for this clock fails. This prevents working with an incorrectly configured clock in some conditions. Signed-off-by: Sylwester Nawrocki --- sound/soc/samsung/i2s.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index ae02811..a634a66 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -488,7 +488,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, clk_id = 1; if (!any_active(i2s)) { - if (i2s->op_clk) { + if (i2s->op_clk && !IS_ERR(i2s->op_clk)) { if ((clk_id && !(mod & MOD_IMS_SYSMUX)) || (!clk_id && (mod & MOD_IMS_SYSMUX))) { clk_disable_unprepare(i2s->op_clk); @@ -506,6 +506,10 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, else i2s->op_clk = clk_get(&i2s->pdev->dev, "i2s_opclk0"); + + if (WARN_ON(IS_ERR(i2s->op_clk))) + return PTR_ERR(i2s->op_clk); + clk_prepare_enable(i2s->op_clk); i2s->rclk_srcrate = clk_get_rate(i2s->op_clk);