Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp673120pxb; Tue, 5 Apr 2022 18:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwX4RpObf54v385hpGz43LI+EbSNpl6a/MzrIGwjQkwVSrlbr8GwcZJznvkpE96xrFBOGfP X-Received: by 2002:a17:906:154c:b0:6ce:21d7:2826 with SMTP id c12-20020a170906154c00b006ce21d72826mr5956004ejd.9.1649207428216; Tue, 05 Apr 2022 18:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207428; cv=none; d=google.com; s=arc-20160816; b=0WpLyp77qUP1DGmWzEvynqRURY6QX/4Mp4LZBfXtKMOcPy8ljUERtTKxMpTOZXZ/iH 5qGsk/I3ort/Ili00B5FyB4EQbDMlHuzpteg5vUnPJHM9Io6YLnC0WXi0hfsLbS9SI7d 4kSBG29x8IeViKwruCA4iMZ5Yac4TPzIVO4H3DrJQu+a+Ygp0kjKHXFStnr4uId6Gw2A Zyl8mAV0zmp2IjfVgWZhFVw4q2LTR2OEbCkMQ6id523z6CmNZHklSvRXAFKYeKFIBQTm CxkBaJuI4jnCpBO4zJ7H+4ophlTdHf43pXX5vTkWl4chhvY+1TjY3nuNxHA3pThXGG1n 0mZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oMKPlH0p1rQLeVtj19KzCSJBjHTU+BEIIoj2Lg+m8RA=; b=ajdju2ObmM7eK6S6/+/VwT9PoEY0Zsk+Y2IfG89DWYeKsmVACtckX8DeJDKPmB8OR4 7u+Q32OwSOg6WYGFi8//BEOQFitR8CfvwSiYP1GgpBsuLoypxpDzaZnGHGWkzta7vcbd PvOvQoVDJvg1Aki3GAZ14K1gVfBh0/ONAxoqkE7LyA2iw2x7Nzsx3DxD4LF6VJtCqdPz 08hq8UT1LVvcJkoNVPoCHzQl54kMsK/iuvPUFtYYzJQxgmhGgEnlWZYdrVAxfZNfiank 72pD0SDyCOTZlNhKxUC4k/yyHffYJM8ACoYyOPd7VsziXGnl4p+qTvigKgVMJQUgw7Ja IdoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="z8ul3/u9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a17090654cd00b006df76385ba1si10578913ejp.65.2022.04.05.18.10.03; Tue, 05 Apr 2022 18:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="z8ul3/u9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356209AbiDELz2 (ORCPT + 99 others); Tue, 5 Apr 2022 07:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244940AbiDEIwt (ORCPT ); Tue, 5 Apr 2022 04:52:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE5602497D; Tue, 5 Apr 2022 01:47:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C4D361509; Tue, 5 Apr 2022 08:47:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B9E9C385A0; Tue, 5 Apr 2022 08:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148429; bh=YDTpRcSaCATao+L5CmLPyxK92OlmEXkjxf7243VK0CQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z8ul3/u9OhmKURHk1l7czvA45CRcXDwqX4MtLb5mBHNdU3VPqWvTfx9gLhHik1bwv fOW8zRymojx5hVXB+fHpacwEvkGTH01+Cxp3Qbxb8TmZt5eFTGuKGb7iB+Dvs8bIKS /PoCvMRBSMTwTx+jUa3w6ztHsyhoNZZDXkBMz3LQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Takashi Iwai , Sasha Levin Subject: [PATCH 5.16 0355/1017] ALSA: spi: Add check for clk_enable() Date: Tue, 5 Apr 2022 09:21:08 +0200 Message-Id: <20220405070404.823053108@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiasheng Jiang [ Upstream commit ca1697eb09208f0168d94b88b72f57505339cbe5 ] As the potential failure of the clk_enable(), it should be better to check it and return error if fails. Fixes: 3568459a5113 ("ALSA: at73c213: manage SSC clock") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20220228022839.3547266-1-jiasheng@iscas.ac.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/spi/at73c213.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 76c0e37a838c..8a2da6b1012e 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c @@ -218,7 +218,9 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream) runtime->hw = snd_at73c213_playback_hw; chip->substream = substream; - clk_enable(chip->ssc->clk); + err = clk_enable(chip->ssc->clk); + if (err) + return err; return 0; } @@ -776,7 +778,9 @@ static int snd_at73c213_chip_init(struct snd_at73c213 *chip) goto out; /* Enable DAC master clock. */ - clk_enable(chip->board->dac_clk); + retval = clk_enable(chip->board->dac_clk); + if (retval) + goto out; /* Initialize at73c213 on SPI bus. */ retval = snd_at73c213_write_reg(chip, DAC_RST, 0x04); @@ -889,7 +893,9 @@ static int snd_at73c213_dev_init(struct snd_card *card, chip->card = card; chip->irq = -1; - clk_enable(chip->ssc->clk); + retval = clk_enable(chip->ssc->clk); + if (retval) + return retval; retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip); if (retval) { @@ -1008,7 +1014,9 @@ static int snd_at73c213_remove(struct spi_device *spi) int retval; /* Stop playback. */ - clk_enable(chip->ssc->clk); + retval = clk_enable(chip->ssc->clk); + if (retval) + goto out; ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS)); clk_disable(chip->ssc->clk); @@ -1088,9 +1096,16 @@ static int snd_at73c213_resume(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); struct snd_at73c213 *chip = card->private_data; + int retval; - clk_enable(chip->board->dac_clk); - clk_enable(chip->ssc->clk); + retval = clk_enable(chip->board->dac_clk); + if (retval) + return retval; + retval = clk_enable(chip->ssc->clk); + if (retval) { + clk_disable(chip->board->dac_clk); + return retval; + } ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN)); return 0; -- 2.34.1