[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211030140255.6410-1-cyeaa@connect.ust.hk>
Date: Sat, 30 Oct 2021 07:02:55 -0700
From: Chengfeng Ye <cyeaa@...nect.ust.hk>
To: mturquette@...libre.com, sboyd@...nel.org, matthias.bgg@...il.com
Cc: linux-kernel@...r.kernel.org, linux-mediatek@...ts.infradead.org,
Chengfeng Ye <cyeaa@...nect.ust.hk>
Subject: [PATCH] clk/mediatek: fix missing null-check for mt8135
The return pointer of mtk_alloc_clk_data could
be null, adding null check for all the call sites.
Signed-off-by: Chengfeng Ye <cyeaa@...nect.ust.hk>
---
drivers/clk/mediatek/clk-mt8135.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/clk/mediatek/clk-mt8135.c b/drivers/clk/mediatek/clk-mt8135.c
index 9b4b645aea99..41c0baab6240 100644
--- a/drivers/clk/mediatek/clk-mt8135.c
+++ b/drivers/clk/mediatek/clk-mt8135.c
@@ -526,6 +526,8 @@ static void __init mtk_topckgen_init(struct device_node *node)
}
clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
+ if (!clk_data)
+ return;
mtk_clk_register_factors(root_clk_alias, ARRAY_SIZE(root_clk_alias), clk_data);
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
@@ -547,6 +549,8 @@ static void __init mtk_infrasys_init(struct device_node *node)
int r;
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
+ if (!clk_data)
+ return;
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
clk_data);
@@ -575,6 +579,8 @@ static void __init mtk_pericfg_init(struct device_node *node)
}
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
+ if (!clk_data)
+ return;
mtk_clk_register_gates(node, peri_gates, ARRAY_SIZE(peri_gates),
clk_data);
--
2.17.1
Powered by blists - more mailing lists