Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9181238pxu; Mon, 28 Dec 2020 08:36:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzVb62dfFdhc0J+WbGpOz7QYEtVmmzYP+U5yjrS3D2hN7H4A8Gy8+6/l3zXIZXBhub0p6E X-Received: by 2002:a17:906:174f:: with SMTP id d15mr35691084eje.52.1609173361947; Mon, 28 Dec 2020 08:36:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173361; cv=none; d=google.com; s=arc-20160816; b=XIMW71547HbpGiwJoRPypaKqUIdbbM9fEVVIVooqrxEl927Mg5YYjPHZrWIhFLhcti rE7+WpmHER+NSJFL0xK/bEOabGYizHaz7Gh09rVY9kjwr9fEHtyar2hkV6WeoNljyXVz 62wHtP7NCI5GptwXNCv6XjnYI+m6ebleypwf4vSkidHV4p+Cl5y7+jXoFedqlyCdtnfT fr3pK1qH82HPY2jDkCu8atslEZ+QvynA+5R+wfrtjBPKPPWBK2oGyRL8p/i+8+PbOZC4 GcRyfkcH0rvbaQ1rX/gCsmENXrJlUjmTSV0lmvn1JWzfaRREhV4fjJPmB/L1h1er72JO s95Q== 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=wRe8C3bDd5lfUTO8kb7Yy74805CiWDdrHbwzy8gCXE8=; b=rNWyIpwazeTDXMU6hczDMMOzHqY7iR0Sv1vWCNFwWoT/zNphFjS2HGgI/sKoGhkY1w Rc7huEgf+iMb3hFOsR1zwtB4N2PEwagMtVJ/5GVQ6BmAybfzVEx0ZNlGRBGr/NK+7FJE ZN8ErvVv9zv/Q4sXgUTmhEAfN4BBVikI+bhO8acmTKkdZh6diffcS9CRLy1REfKuGn+k k6Q21yyJqa2kOs78IXnLi1L/REgd5SxCLOLrFyizZLZ1CwnNHoQPsPF1X+WEg7AQktHN o2yahAC621bgQj64WAYCRmfNQsV59ORBwGTLGC5EzcPH3MwULLRKDy7COJi0MCXT34Of C3ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WkqQDBKq; 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 gk1si3479173ejc.288.2020.12.28.08.35.39; Mon, 28 Dec 2020 08:36:01 -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=WkqQDBKq; 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 S1730303AbgL1NDx (ORCPT + 99 others); Mon, 28 Dec 2020 08:03:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:59608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730227AbgL1ND2 (ORCPT ); Mon, 28 Dec 2020 08:03:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9CF122573; Mon, 28 Dec 2020 13:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160567; bh=fFgjqtNzjhq0Xmfr4i9HWTxs+CYOufaz+Ll0bbXpvns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WkqQDBKqcRCF782CAZWrlhT6xx+7hEZLm1x8ASQFuZmqwk+7eYE/jQY0HBtbPRRlm mrJGFAlbgjXwLnjLVckMDP4wVSTBrZopSfDYyTAHbiyWL9UvtZv42JbqsUdDH2iPF9 AZ171KXY/aajrV0xmJmAhP4m1HCqrkPzjrT7FjDk= 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.9 095/175] ASoC: jz4740-i2s: add missed checks for clk_get() Date: Mon, 28 Dec 2020 13:49:08 +0100 Message-Id: <20201228124857.848896905@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 0dc1ab48fcebe..6440729facaf0 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -315,10 +315,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