From patchwork Sat Jul 22 13:24:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuanjun Gong X-Patchwork-Id: 705340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 979B5EB64DC for ; Sat, 22 Jul 2023 13:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbjGVNZG (ORCPT ); Sat, 22 Jul 2023 09:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbjGVNZF (ORCPT ); Sat, 22 Jul 2023 09:25:05 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8EF001BC for ; Sat, 22 Jul 2023 06:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=k60bfgSHnufwdsuL/V rQCeHercaRykySi87mJviHCbE=; b=O52WPEgkyAqOE3k7iZ0aqSvyY2mkvulLiJ lfwexMVCTjLKLlLaeT0MFwt04Dxkj1yuu3wnRS+UsF0HVRvKwMjPRVcwSPocUar6 /Ik+5OASM3u6+SrUuaV5uqpwqJYggb/HgLGqqGa/QXXUfUaOKvqODCvayVBpz/Qy J/vlV7osU= Received: from localhost.localdomain (unknown [202.112.113.212]) by zwqz-smtp-mta-g0-4 (Coremail) with SMTP id _____wBnMYiG2Ltkd9wlBA--.18453S4; Sat, 22 Jul 2023 21:24:28 +0800 (CST) From: Yuanjun Gong To: quic_bjorande@quicinc.com Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, ruc_gongyuanjun@163.com, vkoul@kernel.org Subject: [PATCH v2 1/1] Soundwire: fix the return value checks of clk_prepare_enable() Date: Sat, 22 Jul 2023 21:24:19 +0800 Message-Id: <20230722132419.37197-1-ruc_gongyuanjun@163.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230721034540.GA1428172@hu-bjorande-lv.qualcomm.com> References: <20230721034540.GA1428172@hu-bjorande-lv.qualcomm.com> X-CM-TRANSID: _____wBnMYiG2Ltkd9wlBA--.18453S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7XF43tFWrur1rKryUAry7KFg_yoWkJFg_C3 95Wrs3Wr45Wws2y347Ww43JrWkKa1kuF4SgF40vw4ftr9rJr9Ivr4kZr9rCws8Xw47Ary0 yF15Za17ArySyjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRNOJ5UUUUUU== X-Originating-IP: [202.112.113.212] X-CM-SenderInfo: 5uxfsw5rqj53pdqm30i6rwjhhfrp/1tbiUR605WDESYQCgAABs0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org in qcom_swrm_probe() and swrm_runtime_resume(), the return value of function clk_prepare_enable() should be checked, since it may fail. Signed-off-by: Yuanjun Gong --- drivers/soundwire/qcom.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 7970fdb27ba0..cf1e13a35023 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -1555,7 +1555,9 @@ static int qcom_swrm_probe(struct platform_device *pdev) goto err_init; } - clk_prepare_enable(ctrl->hclk); + ret = clk_prepare_enable(ctrl->hclk); + if (ret) + goto err_init; ctrl->dev = dev; dev_set_drvdata(&pdev->dev, ctrl); @@ -1673,7 +1675,9 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev) disable_irq_nosync(ctrl->wake_irq); } - clk_prepare_enable(ctrl->hclk); + ret = clk_prepare_enable(ctrl->hclk); + if (ret) + return ret; if (ctrl->clock_stop_not_supported) { reinit_completion(&ctrl->enumeration);