From patchwork Sat Jun 20 21:18:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 6651731 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C3EEA9F1C1 for ; Sat, 20 Jun 2015 21:18:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED2B3206DF for ; Sat, 20 Jun 2015 21:18:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B5C9C20668 for ; Sat, 20 Jun 2015 21:18:45 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 62D14260867; Sat, 20 Jun 2015 23:18:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, SUBJ_OBFU_PUNCT_MANY, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A0D7D260557; Sat, 20 Jun 2015 23:18:36 +0200 (CEST) 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 27CE326058F; Sat, 20 Jun 2015 23:18:35 +0200 (CEST) Received: from mail-qg0-f46.google.com (mail-qg0-f46.google.com [209.85.192.46]) by alsa0.perex.cz (Postfix) with ESMTP id EB12B260526 for ; Sat, 20 Jun 2015 23:18:27 +0200 (CEST) Received: by qgal13 with SMTP id l13so44878646qga.3 for ; Sat, 20 Jun 2015 14:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=uQE4mZb3cvXeWNKb/Q2sQdgLEwrNKAZFkmdqlb+iLjk=; b=0aMaqEScvlSGtpB25WQrhj9vlZOd7nD6OA3eVPJ155wF0Mc9b473V4QYDn3XNt0nxY YNEQACO3sRaqYI4s5Pv7Yuw64jK8Lk7JpNVEadxnqPRa0lN+zyWGia52hEMV5sNPiO4L /QUbdsUSk9Q2smkoYpeZ/NwSkzLNbuvp+dNq1oPXbWyDNbRRAK8clzft+hvTTMK9fzeK v82/MREnd6zK6GFhOeD4bK2eAElPFPhZsjd3L1Fp4s/cRqlo2f693bi8yu+/uq6yocSH nyAS5fUPERe1wRwZQpzEFiL3yEzeBVXqt6/BxgwNOMBoelYMHDoYAkRkgLPR4zrLIuSe ZDjg== X-Received: by 10.140.148.67 with SMTP id 64mr31080066qhu.74.1434835106904; Sat, 20 Jun 2015 14:18:26 -0700 (PDT) Received: from localhost.localdomain ([189.101.187.123]) by mx.google.com with ESMTPSA id z81sm4911348qkg.44.2015.06.20.14.18.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 20 Jun 2015 14:18:25 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Sat, 20 Jun 2015 18:18:06 -0300 Message-Id: <1434835086-27176-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: nicoleotsuka@gmail.com, Fabio Estevam , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH] ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error 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 From: Fabio Estevam clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam Acked-by: Nicolin Chen --- sound/soc/fsl/fsl_spdif.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 8e93221..489fa86 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -482,13 +482,18 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream, mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK | SCR_TXSEL_MASK | SCR_USRC_SEL_MASK | SCR_TXFIFO_FSEL_MASK; - for (i = 0; i < SPDIF_TXRATE_MAX; i++) - clk_prepare_enable(spdif_priv->txclk[i]); + for (i = 0; i < SPDIF_TXRATE_MAX; i++) { + ret = clk_prepare_enable(spdif_priv->txclk[i]); + if (ret) + goto disable_txclk; + } } else { scr = SCR_RXFIFO_FSEL_IF8 | SCR_RXFIFO_AUTOSYNC; mask = SCR_RXFIFO_FSEL_MASK | SCR_RXFIFO_AUTOSYNC_MASK| SCR_RXFIFO_CTL_MASK | SCR_RXFIFO_OFF_MASK; - clk_prepare_enable(spdif_priv->rxclk); + ret = clk_prepare_enable(spdif_priv->rxclk); + if (ret) + goto err; } regmap_update_bits(regmap, REG_SPDIF_SCR, mask, scr); @@ -497,6 +502,9 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream, return 0; +disable_txclk: + for (i--; i >= 0; i--) + clk_disable_unprepare(spdif_priv->txclk[i]); err: clk_disable_unprepare(spdif_priv->coreclk);