Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2849984pxb; Mon, 18 Apr 2022 09:30:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkNxP8lP7cKmR1z9HKOwMlm3HcyhI64+PUIfmORYLvIF5bmz6i4kDqBqdSo6J/P5WEhaal X-Received: by 2002:a05:6a00:1c5c:b0:505:7469:134a with SMTP id s28-20020a056a001c5c00b005057469134amr13133807pfw.16.1650299457635; Mon, 18 Apr 2022 09:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650299457; cv=none; d=google.com; s=arc-20160816; b=Xr8lu7dyoe2PY8g7vKSIbqhngoMGY0bAdSv64neHmDluvzs1y6ESJmY4CfvDubwhCm yjlHIOa0V7kVuU5MgCO4PE2emfRJXv1Pzv5wZfy2D7iXdR3gpYFR5NEY9N4mt1rBICDD 0lsyXiNWxX7t094WP0VZ/2OkM3RH344Z1ZBTiVXAuTapRYorjLX/xH/7v/ybwkzumkOO 666YPcdc386Wb2Kt+WhP9GmlVSmuFJ+mBONWdt4prcYC7Ur5IELz/EiZN4RO0jRJmirY 0WwcinmHSBGG1cEUmhi/O2sPhVKaKl2PHFGbU3lEb/FNMTjF1Bv/ZWUyy5JS4KWTpU4+ PhAg== 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=E4sPSrCuT45pDvu1JsZ1yKJyF4WPz4YOZsRq9zlcYzQ=; b=ETBN2tG3LnUh3G2wYRmiS9fQGG1e/fcNJ8tSBJJfWolbAT0u312fdnbplCoOZ1uCJK g2yUhjiUBLB0CSYcglnNzqgDn8iTu0pwHvXZoBk4VO7Jr49w0gEWIt4lefdKUhG92sjU +tq2T3jxdFA98Jg902VtxyernbeYvwdvnqMHyuUTi+s4k3zoo+mpXJvJAwe6N6ybFYkz jyR8+ifS/F4ldtfvJXkdzc+S91QZWmic95D7eLEfp24NBLvji5MKtJJlMNolai5mCaUk TmpdAXHj6xMk1ojpUDkZp5V9SNZ0s28jqICnI24FPM1tGlNVB2nx0Hf+ei8O877pOoj/ 8wIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MdIiIToD; 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 e4-20020a637444000000b0039905bfa26esi10978081pgn.788.2022.04.18.09.30.40; Mon, 18 Apr 2022 09:30:57 -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=MdIiIToD; 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 S242699AbiDRNmK (ORCPT + 99 others); Mon, 18 Apr 2022 09:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242381AbiDRNNv (ORCPT ); Mon, 18 Apr 2022 09:13:51 -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 7DE7E3A5CE; Mon, 18 Apr 2022 05:51:05 -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 EEBD761287; Mon, 18 Apr 2022 12:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2D6DC385A7; Mon, 18 Apr 2022 12:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286264; bh=NAcl7/luNxaqo7WGAyVzIXBeNq36zhOZfxuDr7K0cYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MdIiIToDS3bnu3JYhYYBlQ8LUToBnrR701BVCx1aaqB5IpeOXCp5/HdB/vPKeCuT8 O3aaIEjZZTXQsg4N/q9LRQBB2pULn8ZTCcAhyr/I6OfzsxsrCoIaamql/WqvTTEakD UED9buqAUOtxkBlpSGeCZm7LGsA0mfxjCW0V0w50= 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 4.14 078/284] ALSA: spi: Add check for clk_enable() Date: Mon, 18 Apr 2022 14:10:59 +0200 Message-Id: <20220418121212.904487633@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@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.7 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 1ef52edeb538..3763f06ed784 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c @@ -221,7 +221,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; } @@ -787,7 +789,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); @@ -900,7 +904,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) { @@ -1019,7 +1025,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); @@ -1099,9 +1107,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