Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3705743pxb; Mon, 24 Jan 2022 15:54:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfBJ9SLLsPekfORTg9YK4CqxbFsIkce7sXX6TWaoI+TvwrqSG+nbsb6uVj2G2G0SsqPSbO X-Received: by 2002:a17:90b:33ca:: with SMTP id lk10mr723438pjb.45.1643068473319; Mon, 24 Jan 2022 15:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068473; cv=none; d=google.com; s=arc-20160816; b=anSM3zjvZ8S+igfuxulY3bKuqtbrL+/q1z0ZLZlyBQUESVondswYRMEm1RXPD0/PUI K84dryfxEpmODwu+hQGqgpAm/zb49swPCHYrj5uMUXf/380Yt/CJwIIIMNi+C+LyGLQ/ linBh00tUkFyomE3lfR/jOojJV9qzaHA12+YOPUX60eZZg1QOg1GS9cgZDpOaUxHyO+v ELHxNr/1cILKqoan3OuTWjKH3yJ0QkB61aPlyLcnpiPDM0TmPTVhhyCqMmxgS12uzYyA C9SvCAOsfK3/gL3wL6eDvBokSwYPzj4dxjN94jNhExlGQ3+LC+hwZRmafeK6gSzKbx2i 6Hrw== 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=g61gC5++W3BMU1+1RFwlXaa9rCEq2/1sWIXRPuONGNQ=; b=WrKWKSMn2CsIR9XYWbG+/xjtVQ8PoSL/BIoOPna1p3mWkgGBnP+tw1cTAKLkkLIhZN jNsH6r7g+VC9oW2uSoZ7Tx0pYbaffy6Yqo34SwecSAQlCz/yKz7h42tmceTBbbrpoSTF s+C+oK6t89HpxDuLx8+7PpVHyzCrUEM4YeJVLbVhfIJbR2qTCwN6ihjv45aSetlNH/GA IzYDYn/K/qE9ie8s7Yeucp2sCZASx/2+vdW2va0rtXezElXTcPgtR0zs5qckbsC+IY5t zlJtNY0tiu+50+feYkaHYob2DBXCauGBY5CpiSvF563osaWXB1LQcqWoN0w6ujEqz7Nq TDZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hxYvk1Nv; 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 s33si14081544pgm.603.2022.01.24.15.54.20; Mon, 24 Jan 2022 15:54:33 -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=hxYvk1Nv; 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 S2365011AbiAXXuB (ORCPT + 99 others); Mon, 24 Jan 2022 18:50:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1844751AbiAXXKO (ORCPT ); Mon, 24 Jan 2022 18:10:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25D26C0A0293; Mon, 24 Jan 2022 13:18:32 -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 ams.source.kernel.org (Postfix) with ESMTPS id D8346B8105C; Mon, 24 Jan 2022 21:18:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09D05C340E4; Mon, 24 Jan 2022 21:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059109; bh=4F+FoEJCjA5dc535C82+wg9z4q7LEbCQMztv5Eb7YX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxYvk1NvioHd+hI0vkJay7fSKDA9Ng75Tx14pGrGfYtvAlhm2QEbR/ea6qeGSgAfb oIkwcQylyQq1WI9S6Dgu8xprCc+/amBqidw558oNZpBw3q9yTV4Z0/UkxGwFdDQ6KR 6vYyC0eGuUabI3G9NVKRGiO/HY4YDbwOQZ1SH3Xs= 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.16 0506/1039] ASoC: mediatek: Check for error clk pointer Date: Mon, 24 Jan 2022 19:38:15 +0100 Message-Id: <20220124184142.289822041@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 ca75b14931ec9..670cc82d17dc2 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -411,12 +411,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, @@ -426,7 +431,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]; @@ -481,7 +486,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