Unverified Commit c1dd310f authored by Qianfeng Rong's avatar Qianfeng Rong Committed by Mark Brown
Browse files

spi: SPISG: Use devm_kcalloc() in aml_spisg_clk_init()



Replace calls of devm_kzalloc() with devm_kcalloc() in aml_spisg_clk_init()
for safer memory allocation with built-in overflow protection, and replace
sizeof(struct clk_div_table) with sizeof(*tbl) to shorten the line.

Signed-off-by: default avatarQianfeng Rong <rongqianfeng@vivo.com>
Link: https://patch.msgid.link/20250819040239.434863-1-rongqianfeng@vivo.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f5accfde
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -662,7 +662,7 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base)

	clk_disable_unprepare(spisg->pclk);

	tbl = devm_kzalloc(dev, sizeof(struct clk_div_table) * (DIV_NUM + 1), GFP_KERNEL);
	tbl = devm_kcalloc(dev, (DIV_NUM + 1), sizeof(*tbl), GFP_KERNEL);
	if (!tbl)
		return -ENOMEM;