Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://patch.msgid.link/20250819040239.434863-1-rongqianfeng@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Qianfeng Rong and committed by
Mark Brown
c1dd310f f5accfde

+1 -1
+1 -1
drivers/spi/spi-amlogic-spisg.c
··· 662 662 663 663 clk_disable_unprepare(spisg->pclk); 664 664 665 - tbl = devm_kzalloc(dev, sizeof(struct clk_div_table) * (DIV_NUM + 1), GFP_KERNEL); 665 + tbl = devm_kcalloc(dev, (DIV_NUM + 1), sizeof(*tbl), GFP_KERNEL); 666 666 if (!tbl) 667 667 return -ENOMEM; 668 668