Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9087489pxu; Mon, 28 Dec 2020 06:19:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyn0OyMNHXEQwZIelCFrABcwHe5QD7DNBntEA0jgu7vX8XiHkZM6aar8hpfI1EDVsnBlviK X-Received: by 2002:a05:6402:312b:: with SMTP id dd11mr42935846edb.308.1609165181248; Mon, 28 Dec 2020 06:19:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165181; cv=none; d=google.com; s=arc-20160816; b=zt+T5urXlouqSMa1z00PWLA8fnppm4eV0bMr6i1dit1a1kGSVkR1E7esipqRbGbo0p PF2x+OqkgOGAe/EzyBu+0jaFeJS1O8ZkDS9F4s69X9CBjnuEvWgApMlOLlL4VUbyzEz2 A/JhDqWqh0UpLqiDOyxxpG3sra1VO2hRy+OWWYADk/xPJli0WaI0J59DNmyHWGpkHC1p 6Y6xUsHOB4xFA8D0stjkdjAo7D08c5HzBQ82x/taf6LEzifvnlbA+Rv79trsfg/kdahj rcVzO7m/w+duFwloxDxjjhRcNk9UWabOOcpXgzlxwPLe6HbSyEhcQQuw4RigKTjtMtFg xwMQ== 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=hISfQvFbSPYss0P2os3BSPrPNV0xhgmCzoAp/haYouE=; b=Bix90yEF8q6sEq4NpLLQ7f319CIlMs+Lqbj9nyi84UuV/CEscjeahYCs04aTGq18SN VJEaNXfS628m6y838ALk/Vq5TnKoMFWHeIMTwKNlTCOM3/priEr/zykRlKsxzH2RU0Sy nBgSCkFWJw8mbNfTCZ26xI9T2I0jcKiMP1CIOUp7iRJQ25iJMXx3MnW8C5ZrXHK2ucOv H7xvA+/debVbYk7M3uE3ypjl+dRX4gZQce74Lr1JlLJyRqvcoSZUFqRklDTJva+V3f/j GIca5UUoVPDM3YZQY58tP/ec7nRN/TZbSsTzk8qEjbEsqllb/LD0vSgynK2D8TK6CZR4 k55g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B4b5E7Ke; 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 q25si19178367edw.87.2020.12.28.06.19.18; Mon, 28 Dec 2020 06:19:41 -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=B4b5E7Ke; 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 S2441432AbgL1ORS (ORCPT + 99 others); Mon, 28 Dec 2020 09:17:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:52228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439596AbgL1ORD (ORCPT ); Mon, 28 Dec 2020 09:17:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BBC9021D94; Mon, 28 Dec 2020 14:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164983; bh=w4YmsWXHjdQPGZvq3Q0Eia9vzReOyT6SGDhhpyVpUww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4b5E7KeLODPE+kQWun1KmNPbavN0Q2b4TZ6R9+9cOSnyzXcv1VAJmEmjooIUiznR oMwFiDK4A+zJQdsOOW0LQIdJ/wB0Fow0CZmp7r4xQt4JKFBCDNn784XFOROUaNRemq F8+Wot23VqNnsuLjr7eVl7pbMf1a2GXnYCyasGow= 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 5.10 368/717] ASoC: amd: change clk_get() to devm_clk_get() and add missed checks Date: Mon, 28 Dec 2020 13:46:06 +0100 Message-Id: <20201228125038.638623156@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 95d3befbc5e1ee39fc8a78713924cf7ed2b3cabe ] cz_da7219_init() does not check the return values of clk_get(), while da7219_clk_enable() calls clk_set_rate() to dereference the pointers. Add checks to fix the problems. Also, change clk_get() to devm_clk_get() to avoid data leak after failures. Fixes: bb24a31ed584 ("ASoC: AMD: Configure wclk and bclk of master codec") Signed-off-by: Chuhong Yuan Link: https://lore.kernel.org/r/20201204063610.513556-1-hslester96@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/amd/acp-da7219-max98357a.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index a7702e64ec512..849288d01c6b4 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -73,8 +73,13 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) return ret; } - da7219_dai_wclk = clk_get(component->dev, "da7219-dai-wclk"); - da7219_dai_bclk = clk_get(component->dev, "da7219-dai-bclk"); + da7219_dai_wclk = devm_clk_get(component->dev, "da7219-dai-wclk"); + if (IS_ERR(da7219_dai_wclk)) + return PTR_ERR(da7219_dai_wclk); + + da7219_dai_bclk = devm_clk_get(component->dev, "da7219-dai-bclk"); + if (IS_ERR(da7219_dai_bclk)) + return PTR_ERR(da7219_dai_bclk); ret = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_LINEOUT | -- 2.27.0