Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9170885pxu; Mon, 28 Dec 2020 08:19:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxC6mA3dPWqRpaGnPZeR60Gig6oj6KasFQfc2w3vFGih0NHTQDXFcRxGUVOy2Vl0IQgS4ML X-Received: by 2002:a17:906:17d5:: with SMTP id u21mr26811521eje.109.1609172399481; Mon, 28 Dec 2020 08:19:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172399; cv=none; d=google.com; s=arc-20160816; b=w3Kcl2/Kx7I7h0p6/Hn2JIe2a+SaWpQ/8Ln1P44NjRQQ0X+YZVFVr+TNPlUWJw03eP l/kRM7Q2yAq+ojFg8CYGuLpubsOc90frH1oftUC5aICqAgjI/IdjBWJVZgpAOP1ub3mt Je69JCIh/rXzkOzKGaGIhx/zJUyYratrZ1Oz+LevhYWqW2qtzdC9RP2fDTLNle97ylrP 1Hfac7ltpo0EDQq4HWlTOpPXzHsK3ezNMpqDetavPMXWBBi5OLvmXJ5v7047znNd3bfu VaZq1zLZSEbxLBa0EjmZp9nOCCsODRFhliIxxiEN6QulvxXY7X+zH1NBCgFo3P7NCJB+ OkuA== 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=I9f6z2pzbLcLfQjsny3W9YXX3E6JO8Ecw+HJrvtKp7c=; b=srWkjyKs1buuvOitg+A1t2FJFUdBwi7wsyuk49HOCq0iV53pBLmLvMejb9bTh8jVEs TTFhf+W43rNbfRhXX9M3ft4JKPdtij1uuDpP/rdH/9XVD4sw3+OFh8bw/+iZnlkWVgGg Ha1nsdbf3HXW0ovD7saiEwpeQTh+WcAdgrIXf7cWiKP27zmHDuFapgZfL2NWqYF4b6iO /QPWc95pRibJgDJ4MZ/gFTqPPfpzOxViUxteNNGSh0FPqncXc9wVaiC+9EppFes3q1vL 3CJtRC5461mSlsjnesGFj3ldgf00Uk3I0G6vK0dAABpj+obguE1CA5w/+CufuxTSXojn B/Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eEbFuk6k; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si20053021edp.56.2020.12.28.08.19.37; Mon, 28 Dec 2020 08:19:59 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eEbFuk6k; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733189AbgL1NQX (ORCPT + 99 others); Mon, 28 Dec 2020 08:16:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:44398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732904AbgL1NQF (ORCPT ); Mon, 28 Dec 2020 08:16:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 347BA20776; Mon, 28 Dec 2020 13:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161324; bh=e7PJ60N0tiJPWbx21m2LVM5TJk2QavQRE4Mm0hJiDA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eEbFuk6kdWijxGzmjVz+YSSzNRxTb7vb6RQ/knHecSOnx3UeIt/O0C++axGK77HVb 1WX/c6RXX5BmPEBstT/MYouTZfRDtqc5E3Q6Rl4gxXgtR7hxAaRUWXBDczs1cEDwzm khDoLLwa9TqwLTkM8gWkwqFHjkZEa5mU6SHoQpjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Mark Brown , Sasha Levin Subject: [PATCH 4.14 136/242] ASoC: jz4740-i2s: add missed checks for clk_get() Date: Mon, 28 Dec 2020 13:49:01 +0100 Message-Id: <20201228124911.402696382@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuhong Yuan [ Upstream commit 1c1fb2653a0c2e3f310c07eacd8fc3a10e08c97a ] jz4740_i2s_set_sysclk() does not check the return values of clk_get(), while the file dereferences the pointers in clk_put(). Add the missed checks to fix it. Fixes: 11bd3dd1b7c2 ("ASoC: Add JZ4740 ASoC support") Signed-off-by: Chuhong Yuan Link: https://lore.kernel.org/r/20201203144227.418194-1-hslester96@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/jz4740/jz4740-i2s.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index e099c0505b765..2c6b0ac97c684 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -318,10 +318,14 @@ static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, switch (clk_id) { case JZ4740_I2S_CLKSRC_EXT: parent = clk_get(NULL, "ext"); + if (IS_ERR(parent)) + return PTR_ERR(parent); clk_set_parent(i2s->clk_i2s, parent); break; case JZ4740_I2S_CLKSRC_PLL: parent = clk_get(NULL, "pll half"); + if (IS_ERR(parent)) + return PTR_ERR(parent); clk_set_parent(i2s->clk_i2s, parent); ret = clk_set_rate(i2s->clk_i2s, freq); break; -- 2.27.0