Skip to content

Commit c1dd310

Browse files
qianfengrongbroonie
authored andcommitted
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>
1 parent f5accfd commit c1dd310

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/spi/spi-amlogic-spisg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base)
662662

663663
clk_disable_unprepare(spisg->pclk);
664664

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);
666666
if (!tbl)
667667
return -ENOMEM;
668668

0 commit comments

Comments
 (0)