5a3d498bcbb02e68d0d588ca9d6f6a57faf44127
[openwrt/staging/xback.git] /
1 From f48d80503504257682e493dc17408f2f0b47bcfa Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <j4g8y7@gmail.com>
3 Date: Thu, 20 Mar 2025 19:11:59 +0100
4 Subject: [PATCH] spi: spi-qpic-snand: use kmalloc() for OOB buffer allocation
5
6 The qcom_spi_ecc_init_ctx_pipelined() function allocates zeroed
7 memory for the OOB buffer, then it fills the buffer with '0xff'
8 bytes right after the allocation. In this case zeroing the memory
9 during allocation is superfluous, so use kmalloc() instead of
10 kzalloc() to avoid that.
11
12 Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
13 Link: https://patch.msgid.link/20250320-qpic-snand-kmalloc-v1-1-94e267550675@gmail.com
14 Signed-off-by: Mark Brown <broonie@kernel.org>
15 ---
16 drivers/spi/spi-qpic-snand.c | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19 --- a/drivers/spi/spi-qpic-snand.c
20 +++ b/drivers/spi/spi-qpic-snand.c
21 @@ -261,7 +261,7 @@ static int qcom_spi_ecc_init_ctx_pipelin
22 ecc_cfg = kzalloc(sizeof(*ecc_cfg), GFP_KERNEL);
23 if (!ecc_cfg)
24 return -ENOMEM;
25 - snandc->qspi->oob_buf = kzalloc(mtd->writesize + mtd->oobsize,
26 + snandc->qspi->oob_buf = kmalloc(mtd->writesize + mtd->oobsize,
27 GFP_KERNEL);
28 if (!snandc->qspi->oob_buf) {
29 kfree(ecc_cfg);