Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2584306ybt; Mon, 22 Jun 2020 02:02:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfbwmbosGeaIWr2GUAttSu7TaFTfBrV/0LJkp3/oxCaPTN0jy3I/NzBslA7mk1/U039jWw X-Received: by 2002:aa7:c314:: with SMTP id l20mr369221edq.150.1592816548698; Mon, 22 Jun 2020 02:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592816548; cv=none; d=google.com; s=arc-20160816; b=gCvKtNjPRdWlP6fCGWRSORiCrJYlrFP382VrfgyrlkFGDVbKO96KH9DrB0XmW0dADh HA3XGr0/OzEug+yTNkiHaWP0dorOWqmUuh/K9hqsHFls505JVd+L/IAww0G9h+QAuegA 5NWvRI+U9USqcFxqq3AtyPjz05efH986fsZkV6Ci/Vi9b/9KsUn3dNiRa4FYIKG3mkEM vEXLGFTSrTyQ6zWyOK0jm/pB3SWJa7M/Gr/eqIQ63wFAdcSHGyVzJ9KnQYinQpHVp7wg 4rVMPnJRiFWixJrCiW9QnbZQi/w1tZso1j6+xeyJV3tyge33y9zpKo2O2mg1Hdogix6n 7CuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=U4MFXmIWVCzNcd31bhm2qqZy/BvNMt7mQEgm523aQUY=; b=BRyH6+aoRXXwUh8QrE7V4g5zbyfKDGdEs3lgULpQ93zBhIuWJ9CGJHVdgfjJHTKfi2 842cuzcR27YuE1ozn5qxZFVsV9mw3opa705XFZvfP8sBjAMMAljvmkVCpgO4eQu569Yb eIht+5Lm+8+OJV/jbKXVCVle8iYn4JqbBSXzzOM4Pmps9BbNouzWROUjECBX5s3ilUVP PX2XRFymSULB529tnold4I3kOulgc3QgFyajSMgQMkFK/GlufWQdRywD6QOyXSFxLnib scOw8XXhdmYVKBffwFcSHxxzFJFaFpBZYPYxscpUQ2KoKyDbKeSI8rt/Eb9gf7JhCnnZ 2Y9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si9455824edp.99.2020.06.22.02.02.05; Mon, 22 Jun 2020 02:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbgFVJAL (ORCPT + 99 others); Mon, 22 Jun 2020 05:00:11 -0400 Received: from inva020.nxp.com ([92.121.34.13]:46820 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbgFVJAL (ORCPT ); Mon, 22 Jun 2020 05:00:11 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 900BE1A0B85; Mon, 22 Jun 2020 11:00:09 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 66EB51A0B76; Mon, 22 Jun 2020 11:00:05 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 26CA8402CA; Mon, 22 Jun 2020 16:59:59 +0800 (SGT) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: fsl_mqs: Fix unchecked return value for clk_prepare_enable Date: Mon, 22 Jun 2020 16:48:45 +0800 Message-Id: <1592815725-853-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix unchecked return value for clk_prepare_enable. And because clk_prepare_enable and clk_disable_unprepare should check input clock parameter is NULL or not, then we don't need to check it before calling the function. Fixes: 9e28f6532c61 ("ASoC: fsl_mqs: Add MQS component driver") Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_mqs.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sound/soc/fsl/fsl_mqs.c b/sound/soc/fsl/fsl_mqs.c index 0c813a45bba7..69aeb0e71844 100644 --- a/sound/soc/fsl/fsl_mqs.c +++ b/sound/soc/fsl/fsl_mqs.c @@ -265,12 +265,20 @@ static int fsl_mqs_remove(struct platform_device *pdev) static int fsl_mqs_runtime_resume(struct device *dev) { struct fsl_mqs *mqs_priv = dev_get_drvdata(dev); + int ret; - if (mqs_priv->ipg) - clk_prepare_enable(mqs_priv->ipg); + ret = clk_prepare_enable(mqs_priv->ipg); + if (ret) { + dev_err(dev, "failed to enable ipg clock\n"); + return ret; + } - if (mqs_priv->mclk) - clk_prepare_enable(mqs_priv->mclk); + ret = clk_prepare_enable(mqs_priv->mclk); + if (ret) { + dev_err(dev, "failed to enable mclk clock\n"); + clk_disable_unprepare(mqs_priv->ipg); + return ret; + } if (mqs_priv->use_gpr) regmap_write(mqs_priv->regmap, IOMUXC_GPR2, @@ -292,11 +300,8 @@ static int fsl_mqs_runtime_suspend(struct device *dev) regmap_read(mqs_priv->regmap, REG_MQS_CTRL, &mqs_priv->reg_mqs_ctrl); - if (mqs_priv->mclk) - clk_disable_unprepare(mqs_priv->mclk); - - if (mqs_priv->ipg) - clk_disable_unprepare(mqs_priv->ipg); + clk_disable_unprepare(mqs_priv->mclk); + clk_disable_unprepare(mqs_priv->ipg); return 0; } -- 2.21.0