Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3574411pxb; Mon, 24 Jan 2022 12:34:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJcfT35c1aV+jhqg+dyVQgDODGZtrKM7Mi/NOzLkSxP6Na8Q36LKuGOOom9euZsiEKLuuT X-Received: by 2002:a63:214f:: with SMTP id s15mr12956904pgm.256.1643056457951; Mon, 24 Jan 2022 12:34:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056457; cv=none; d=google.com; s=arc-20160816; b=qr2c7nXf0TwJlENBUmk4t5BqtXUzWLczBy/VJPYXXpKvwjeY8k3F11/ryZrVxsUftl ++4StnVx3V+yOUebHFwM6VxbxP6lGAOPtEl9Yptlczl95iOi5ETp9lGjFtt3hHZWxrHe lHZRjM2s6HEQHa56ojd7dz0gPVpxn9jkzvMSWTylOzbpiQB9uty2AmY3EgWGvYxGynja ke8PHfk0t3xB+0GeGyAtfyKim0dXk9oc7FfhKKxYtlxdBOg0KR88n6nLhLR+3a0Rfxcr vcF587vcI82dUUXb2RM/fcWFg95NHwNMQua5B6lPXU2bLgZOizsp/rq7IHBmXpmsp3DI +mcw== 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=tbx1teYF0qX0Xq3YVcsg4QD2JlBqXd2xMTFj7JJhF3s=; b=WLxdyu91L96WelQrhoAYACa1Vdw5qJIZa+W02CYcTgn5+o2MuQjoJ8FTQgvlZLzyph Nti/Ug4IIR3otD4ad8utBovdkQ4RWDqvRWz55snINbHKDREBWzc7h6ZV3B0E78S2jhVb IIrKfhw+79ClLCuo6zMe8i1VGeHKRAbsjf4h3kOzxKU5jkF8ujqgZ+V1I13Ai2pwFuit JgnQGOXDGWuNXlew/DG3eZRLYlwFzwqmJFr0dTogXzKDgteWwLHvo9QSj+IO/Dm66WV1 RVxuwNzunHdfIcT6QK+Ec7BTLeC+m0NsoE3H4s3CYa+GXt874/jwAJ/D5bAjV5nQ9t9y lz7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yzqVMfPb; 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 z20si13819536pgk.122.2022.01.24.12.33.54; Mon, 24 Jan 2022 12:34:17 -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=yzqVMfPb; 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 S1355633AbiAXTnC (ORCPT + 99 others); Mon, 24 Jan 2022 14:43:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57036 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346903AbiAXTbg (ORCPT ); Mon, 24 Jan 2022 14:31:36 -0500 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 3C08B61551; Mon, 24 Jan 2022 19:31:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C6C1C340E5; Mon, 24 Jan 2022 19:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052694; bh=aUjhzXTyAHaJTVFOxM8vpuyzYbSsGkP8DhdJfquucl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yzqVMfPbodcLQM/BzRMJvgL3MDSzDKnX+0+3pT1IjxZiKZJ+7mlVQBCOIZls+snpJ p0wAi5WYaeY0C6I2wWRkqcvZNu58WCg5x/QX3HaQdI4kk7I+RA5yFHh3f0kSeBx6WB mWxr/M7Tl8CKqRzHMDLCxo7XcyayxhnzV56MMtZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.4 145/320] ASoC: mediatek: Check for error clk pointer Date: Mon, 24 Jan 2022 19:42:09 +0100 Message-Id: <20220124183958.566967543@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jiasheng Jiang [ Upstream commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e ] Yes, you are right and now the return code depending on the init_clks(). Fixes: 6078c651947a ("soc: mediatek: Refine scpsys to support multiple platform") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20211222015157.1025853-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/soc/mediatek/mtk-scpsys.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index 75f25f08245fd..71afa2a99b17f 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -333,12 +333,17 @@ out: return ret; } -static void init_clks(struct platform_device *pdev, struct clk **clk) +static int init_clks(struct platform_device *pdev, struct clk **clk) { int i; - for (i = CLK_NONE + 1; i < CLK_MAX; i++) + for (i = CLK_NONE + 1; i < CLK_MAX; i++) { clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); + if (IS_ERR(clk[i])) + return PTR_ERR(clk[i]); + } + + return 0; } static struct scp *init_scp(struct platform_device *pdev, @@ -348,7 +353,7 @@ static struct scp *init_scp(struct platform_device *pdev, { struct genpd_onecell_data *pd_data; struct resource *res; - int i, j; + int i, j, ret; struct scp *scp; struct clk *clk[CLK_MAX]; @@ -403,7 +408,9 @@ static struct scp *init_scp(struct platform_device *pdev, pd_data->num_domains = num; - init_clks(pdev, clk); + ret = init_clks(pdev, clk); + if (ret) + return ERR_PTR(ret); for (i = 0; i < num; i++) { struct scp_domain *scpd = &scp->domains[i]; -- 2.34.1