Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3577127pxb; Mon, 24 Jan 2022 12:38:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYa7OUq+lht/jj43BIPOOodShji3MlU/JaDx981YdN4qQjfos/IhyDvjKrYMmjbLTbDlrr X-Received: by 2002:a63:31d6:: with SMTP id x205mr7480297pgx.276.1643056714652; Mon, 24 Jan 2022 12:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056714; cv=none; d=google.com; s=arc-20160816; b=DMtfjxy1c/rD6sLBFz0+QdVhmk0Hx6DYnp7mkCv/yNMsL0e06zRo1TuA+aLek68tQe uE1hRQHEtQFCEpMBkVVZJl87v3p7SbQgh4wDuWzFzvVvRiGIq5K6CGdBBeB7O0+kScM9 umaKp9pCd1R0pbGLW1ZRS4A+MXpHeeWV+wpjhRsox51oOpUkr4WuDpgD5j72IJJJ48U6 ktXa+PE9BDskkK+MFOrm7dPdAhU9I6Nwh1DlvCJ2HHB1GGjELH8GjrwModdJ8OoNodUs 5gHs1OazfnvZbfhTd7fe4jy/zh17YDg4/0DVCtX3lhY42gD0QFWKAKetnM6x4RsglcMI purg== 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=Mw4fZtr8QqkOiu7EQ+WlwiXA2q6F11gu9HGIbcJRZRg=; b=Dqy3o8nDsmsNpGbTzJRYvmvTry7d8bAHImjl4vhRBHAzYyQmoGAcUKuKUGj+kYiJXM VYR3xBijzY2pu+S5Bh+hYwJ3orzTmpt32zWaC3atJirzDy2N1rXTxSbv8xPOuFxl0zQt zAvbpqW6h8JGDGG7fYFl+SKmMZIWWgiyQTHLDM8JkeSfrPvPsJNbNjcCfTz/FjymK7Fy xd5neaNmbIRUw2MtiKup7B6TFN0AapyXGndzQKtncamQAzPmJ9qKbrRux2TXieHPFRlT yGVx9GoYlL967ay9FU9dFjJHj6Yh61Ht1sleaJNB/xT9pf5J2sdomLh3iXaODHvRNqAv H4yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="r/hOYHoP"; 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 c136si12526895pfc.67.2022.01.24.12.38.15; Mon, 24 Jan 2022 12:38:34 -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="r/hOYHoP"; 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 S1345503AbiAXTvG (ORCPT + 99 others); Mon, 24 Jan 2022 14:51:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345601AbiAXTkg (ORCPT ); Mon, 24 Jan 2022 14:40:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94C17C0613DE; Mon, 24 Jan 2022 11:19:34 -0800 (PST) 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 316B2612F3; Mon, 24 Jan 2022 19:19:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E850FC340E5; Mon, 24 Jan 2022 19:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051973; bh=Yl19xK2S3Yrf+HDHivDr1Qg8Bb/pOf54XZ1Z8dK3gjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r/hOYHoPlyrKbNPul/AbPfHTWi191C6dC8symJckAEkzyRvX2x2ht+ySynNYBJEp+ p6x7Ms9++Cok2xxz07iJDQizdQ+3mJ50XzIO2oljU3tM/mUT9mwGOS1r87FzX96CJL kJYYgNPICz59AY2LiLTnEf6LJETku5xBsLGxS7TI= 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 4.19 114/239] ASoC: mediatek: Check for error clk pointer Date: Mon, 24 Jan 2022 19:42:32 +0100 Message-Id: <20220124183946.729470383@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 ef54f1638d207..01fcad7c8fae8 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -341,12 +341,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, @@ -356,7 +361,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]; @@ -411,7 +416,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