linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] clk: mediatek: clk-mt6765: Add check for mtk_alloc_clk_data
@ 2023-09-12  9:34 Jiasheng Jiang
  2023-09-12  9:34 ` [PATCH 2/5] clk: mediatek: clk-mt6779: " Jiasheng Jiang
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Jiasheng Jiang @ 2023-09-12  9:34 UTC (permalink / raw)
  To: mturquette, sboyd, matthias.bgg, angelogioacchino.delregno, wenst,
	msp, amergnat, frank.li, robh, owen.chen, mars.cheng, macpaul.lin,
	cw00.choi, u.kleine-koenig, wendell.lin, luca.ceresoli,
	kevin-cw.chen, ryder.lee, wenzhen.yu
  Cc: linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek,
	Jiasheng Jiang

Add the check for the return value of mtk_alloc_clk_data() in order to
avoid NULL pointer dereference.

Fixes: 1aca9939bf72 ("clk: mediatek: Add MT6765 clock support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/clk/mediatek/clk-mt6765.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/mediatek/clk-mt6765.c b/drivers/clk/mediatek/clk-mt6765.c
index 1f4c8d0c041a..9c7f7407d798 100644
--- a/drivers/clk/mediatek/clk-mt6765.c
+++ b/drivers/clk/mediatek/clk-mt6765.c
@@ -737,6 +737,8 @@ static int clk_mt6765_apmixed_probe(struct platform_device *pdev)
 		return PTR_ERR(base);
 
 	clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
+	if (!clk_data)
+		return -ENOMEM;
 
 	mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
 
@@ -769,6 +771,8 @@ static int clk_mt6765_top_probe(struct platform_device *pdev)
 		return PTR_ERR(base);
 
 	clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
+	if (!clk_data)
+		return -ENOMEM;
 
 	mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks),
 				    clk_data);
@@ -807,6 +811,8 @@ static int clk_mt6765_ifr_probe(struct platform_device *pdev)
 		return PTR_ERR(base);
 
 	clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK);
+	if (!clk_data)
+		return -ENOMEM;
 
 	mtk_clk_register_gates(&pdev->dev, node, ifr_clks,
 			       ARRAY_SIZE(ifr_clks), clk_data);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-10-19  1:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12  9:34 [PATCH 1/5] clk: mediatek: clk-mt6765: Add check for mtk_alloc_clk_data Jiasheng Jiang
2023-09-12  9:34 ` [PATCH 2/5] clk: mediatek: clk-mt6779: " Jiasheng Jiang
2023-09-12 10:02   ` AngeloGioacchino Del Regno
2023-10-19  1:15   ` Stephen Boyd
2023-09-12  9:34 ` [PATCH 3/5] clk: mediatek: clk-mt6797: " Jiasheng Jiang
2023-09-12 10:02   ` AngeloGioacchino Del Regno
2023-10-19  1:15   ` Stephen Boyd
2023-09-12  9:34 ` [PATCH 4/5] clk: mediatek: clk-mt7629-eth: " Jiasheng Jiang
2023-09-12 10:02   ` AngeloGioacchino Del Regno
2023-10-19  1:15   ` Stephen Boyd
2023-09-12  9:34 ` [PATCH 5/5] clk: mediatek: clk-mt7629: " Jiasheng Jiang
2023-09-12 10:02   ` AngeloGioacchino Del Regno
2023-10-19  1:16   ` Stephen Boyd
2023-09-12 10:02 ` [PATCH 1/5] clk: mediatek: clk-mt6765: " AngeloGioacchino Del Regno
2023-10-19  1:15 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).