[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250320-qpic-snand-kmalloc-v1-1-94e267550675@gmail.com>
Date: Thu, 20 Mar 2025 19:11:59 +0100
From: Gabor Juhos <j4g8y7@...il.com>
To: Mark Brown <broonie@...nel.org>
Cc: Md Sadre Alam <quic_mdalam@...cinc.com>,
Sricharan Ramabadhran <quic_srichara@...cinc.com>,
Varadarajan Narayanan <quic_varada@...cinc.com>, linux-spi@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org, Gabor Juhos <j4g8y7@...il.com>
Subject: [PATCH next] spi: spi-qpic-snand: use kmalloc() for OOB buffer
allocation
The qcom_spi_ecc_init_ctx_pipelined() function allocates zeroed
memory for the OOB buffer, then it fills the buffer with '0xff'
bytes right after the allocation. In this case zeroing the memory
during allocation is superfluous, so use kmalloc() instead of
kzalloc() to avoid that.
Signed-off-by: Gabor Juhos <j4g8y7@...il.com>
---
drivers/spi/spi-qpic-snand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index fbba7741a9bf336deed1c07eab8d5a94204878d7..b60f5c3fd1db84e66f9263404a52251460a4afec 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -261,7 +261,7 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
ecc_cfg = kzalloc(sizeof(*ecc_cfg), GFP_KERNEL);
if (!ecc_cfg)
return -ENOMEM;
- snandc->qspi->oob_buf = kzalloc(mtd->writesize + mtd->oobsize,
+ snandc->qspi->oob_buf = kmalloc(mtd->writesize + mtd->oobsize,
GFP_KERNEL);
if (!snandc->qspi->oob_buf) {
kfree(ecc_cfg);
---
base-commit: ad4488845193e81549c11903a5083b4c9cc19785
change-id: 20250320-qpic-snand-kmalloc-3f6c1fb6c873
Best regards,
--
Gabor Juhos <j4g8y7@...il.com>
Powered by blists - more mailing lists