From patchwork Sat Mar 15 12:44:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Pargmann X-Patchwork-Id: 3837101 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 62654BF540 for ; Sat, 15 Mar 2014 12:55:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7887C20320 for ; Sat, 15 Mar 2014 12:55:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6894B20176 for ; Sat, 15 Mar 2014 12:55:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 817592655A4; Sat, 15 Mar 2014 13:55:25 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 630B926565A; Sat, 15 Mar 2014 13:50:06 +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 E24212655A7; Sat, 15 Mar 2014 13:50:04 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) by alsa0.perex.cz (Postfix) with ESMTP id 774192655A9 for ; Sat, 15 Mar 2014 13:46:04 +0100 (CET) Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:a236:9fff:fe00:814]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1WOnxi-0002y4-Va; Sat, 15 Mar 2014 13:45:15 +0100 Received: from mpa by dude.hi.pengutronix.de with local (Exim 4.82) (envelope-from ) id 1WOnxf-0000Xn-EC; Sat, 15 Mar 2014 13:45:11 +0100 From: Markus Pargmann To: Mark Brown Date: Sat, 15 Mar 2014 13:44:15 +0100 Message-Id: <1394887464-969-8-git-send-email-mpa@pengutronix.de> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1394887464-969-1-git-send-email-mpa@pengutronix.de> References: <1394887464-969-1-git-send-email-mpa@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:a236:9fff:fe00:814 X-SA-Exim-Mail-From: mpa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: alsa-devel@alsa-project.org Cc: Fabio Estevam , alsa-devel@alsa-project.org, Timur Tabi , kernel@pengutronix.de, Nicolin Chen , Markus Pargmann , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 07/16] ASoC: fsl-ssi: baud clock error handling 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds error handling for baud clock. It checks for PROBE_DEFER error codes and handles clk_prepare_enable() errors. Signed-off-by: Markus Pargmann --- sound/soc/fsl/fsl_ssi.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index fcc73d3..663ac8b 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -984,11 +984,19 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, * and, instead, abandon MASTER mode that needs baud clock. */ ssi_private->baudclk = devm_clk_get(&pdev->dev, "baud"); - if (IS_ERR(ssi_private->baudclk)) + if (IS_ERR(ssi_private->baudclk)) { + ret = PTR_ERR(ssi_private->baudclk); + if (ret == -EPROBE_DEFER) + goto error_baud_clk; dev_dbg(&pdev->dev, "could not get baud clock: %ld\n", - PTR_ERR(ssi_private->baudclk)); - else - clk_prepare_enable(ssi_private->baudclk); + PTR_ERR(ssi_private->baudclk)); + } else { + ret = clk_prepare_enable(ssi_private->baudclk); + if (ret) { + dev_err(&pdev->dev, "Failed to enable baud clock\n"); + goto error_baud_clk; + } + } /* * We have burstsize be "fifo_depth - 2" to match the SSI @@ -1012,6 +1020,11 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, } return 0; + +error_baud_clk: + clk_disable_unprepare(ssi_private->clk); + + return ret; } static void fsl_ssi_imx_clean(struct platform_device *pdev,