Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp935457pxb; Wed, 6 Apr 2022 04:46:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSMlVLDJJ+lI+c9gIsVNf7ajLDsA9v34/nRIKwwxnB9fkBJvV6N5XqplVFs5VldDxr/1Zn X-Received: by 2002:a17:90b:1c03:b0:1c7:510e:d0c7 with SMTP id oc3-20020a17090b1c0300b001c7510ed0c7mr9476468pjb.107.1649245582755; Wed, 06 Apr 2022 04:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649245582; cv=none; d=google.com; s=arc-20160816; b=B0oATJmWzg+W3tOeFoitopS36Jievfo29bPI4B3xWXhW6T1l3ctX1D7DTRzscUTv+X /3yAGOIa2ZDWdO7xIpzxFh/4U9qzGXJYvILTMBQgJ+RFnH32hVcHZN61LOGTyKFZA592 8GMOy+YSwQZZ+P2qM7q6CdG0uVIiy9PXYWmWqY/kks0Yjl6/SQVXpqhByNRre7Yunzzw mbJJEAtiPnt/Onht3UXgAzDY9GS/QA35g+Hi0iZBNLQfP3Vvi+y/f/z480WQCHKFawJC f80YAbqoLfiHTdnqcfVlLqGRQJkjgebQWX149Ra8bDRLR9icmD6x4AJFqUBs6USFXpjd efCQ== 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=ptFtKeIemjYJJSRX9nXOcElI3SDesDs6vkJ/2r/8HilntmgcPfGD1pbpk5VFomF5IJ VPgfEsDKUi82A82789ZZGAKXCPa9aBnd2691t+sBwRfh+gGgmQ8uvXqWSeKWHPCBjbCI Gd7Vv9D+C/UAtxsabMjbYI9pZFbmH7sbzPHul0UfF0p1u0vpzmx3xtYInHvxf5z7wV8j 7gJ7x3GUwaRwp12VK3BmMpfnZA4sz05zFHwb7mopnqfDB0POi1zxRykCHbpp5cmZDFTn JVMUDnXhLyLsNC25y3J3zCNFb7WNnnOkHF2XUMKWENe6czvlykYKO8tizTsM5DACk0yT i9lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RU5D2P0b; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u4-20020a170902e5c400b00156a0c53168si9092162plf.624.2022.04.06.04.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:46:22 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RU5D2P0b; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 689926276C3; Wed, 6 Apr 2022 03:03:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbiDEX1j (ORCPT + 99 others); Tue, 5 Apr 2022 19:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348788AbiDEJsg (ORCPT ); Tue, 5 Apr 2022 05:48:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FECB75625; Tue, 5 Apr 2022 02:35:22 -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 ams.source.kernel.org (Postfix) with ESMTPS id DA876B81B93; Tue, 5 Apr 2022 09:35:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED78C385A2; Tue, 5 Apr 2022 09:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151319; bh=YDTpRcSaCATao+L5CmLPyxK92OlmEXkjxf7243VK0CQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RU5D2P0bZ4ScDOyZ9fxc8jisr8I9sGqbwEtqwo279S7oqIJ6Bfsc2shMnp6eJL98q rBtOljzOKgu46pf51A5O6SiJhSwoANaQHh/TxOyclG1KB2ehWKK9XFl0i5UcR6IaKk tZG0RxlgGR4U/988bSOG2GknOgEFv2QTj3rpb064= 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.15 334/913] ALSA: spi: Add check for clk_enable() Date: Tue, 5 Apr 2022 09:23:16 +0200 Message-Id: <20220405070349.860291693@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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