From: Qianfeng Rong Date: Tue, 19 Aug 2025 04:02:38 +0000 (+0800) Subject: spi: SPISG: Use devm_kcalloc() in aml_spisg_clk_init() X-Git-Tag: v6.18-rc1~165^2~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1dd310f1d76b4b13f1854618087af2513140897;p=thirdparty%2Flinux.git 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 Link: https://patch.msgid.link/20250819040239.434863-1-rongqianfeng@vivo.com Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-amlogic-spisg.c b/drivers/spi/spi-amlogic-spisg.c index 2ab8bdf2a6761..64244a0bd4086 100644 --- a/drivers/spi/spi-amlogic-spisg.c +++ b/drivers/spi/spi-amlogic-spisg.c @@ -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;