From patchwork Sat Jun 20 18:41:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 6651451 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 9A7489F326 for ; Sat, 20 Jun 2015 18:42:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D12B1206BE for ; Sat, 20 Jun 2015 18:42:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 89FDE206B0 for ; Sat, 20 Jun 2015 18:41:59 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 27DFD2607C8; Sat, 20 Jun 2015 20:41:58 +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,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 B4037260718; Sat, 20 Jun 2015 20:41:49 +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 A0342260719; Sat, 20 Jun 2015 20:41:48 +0200 (CEST) Received: from mail-qg0-f52.google.com (mail-qg0-f52.google.com [209.85.192.52]) by alsa0.perex.cz (Postfix) with ESMTP id 79121260713 for ; Sat, 20 Jun 2015 20:41:41 +0200 (CEST) Received: by qgal13 with SMTP id l13so44495004qga.3 for ; Sat, 20 Jun 2015 11:41:40 -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=7i5pZKZ8c7cSj4TUMLoJ9Ln2gnumfqVn4mjj51H6rVI=; b=aArmjT+cEgORe5kZ4eYIoZg44V5zgfKwv75AKRWazjRiVuKm/KwMohTRsdTPXkmBVD oa3xareCVc+lZsWYj927ICPkKFsDvR0HDdbqkCTM47urA8SckIYuzLIGn7YGhLSL6pS+ bvJdhbtNCzMXLOMY2T1Thd2KB5kR+6G93QW3ul2Dz4Ue3j6/yMH8PDlE5MTzAMrhyY24 OFPmrXYxBNIykgjqQgg246T0lV8dfWv44i52O0IGrbwNx63J5cHlETgsHHq3y2aBF5qE XYGlHbwNdP5mUTQv1m0fSTaDkTD3t59x+WAZl2N9iEZvD3VysRnA/SxgQIU7zgwm1R4v NQyA== X-Received: by 10.140.91.23 with SMTP id y23mr28533189qgd.90.1434825700374; Sat, 20 Jun 2015 11:41:40 -0700 (PDT) Received: from localhost.localdomain ([189.101.187.123]) by mx.google.com with ESMTPSA id k71sm7570444qhc.42.2015.06.20.11.41.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 20 Jun 2015 11:41:39 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Sat, 20 Jun 2015 15:41:14 -0300 Message-Id: <1434825674-8618-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_asrc: 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 --- sound/soc/fsl/fsl_asrc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index c068494..37dde26 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -931,14 +931,22 @@ static int fsl_asrc_probe(struct platform_device *pdev) static int fsl_asrc_runtime_resume(struct device *dev) { struct fsl_asrc *asrc_priv = dev_get_drvdata(dev); - int i; + int i, ret; - clk_prepare_enable(asrc_priv->mem_clk); - clk_prepare_enable(asrc_priv->ipg_clk); + ret = clk_prepare_enable(asrc_priv->mem_clk); + if (ret) + return ret; + ret = clk_prepare_enable(asrc_priv->ipg_clk); + if (ret) + goto disable_mem_clk; for (i = 0; i < ASRC_CLK_MAX_NUM; i++) clk_prepare_enable(asrc_priv->asrck_clk[i]); return 0; + +disable_mem_clk: + clk_disable_unprepare(asrc_priv->mem_clk); + return ret; } static int fsl_asrc_runtime_suspend(struct device *dev)