[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251023024250.3181084-1-pengcan@kylinos.cn>
Date: Thu, 23 Oct 2025 10:42:50 +0800
From: Can Peng <pengcan@...inos.cn>
To: broonie@...nel.org
Cc: linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Can Peng <pengcan@...inos.cn>
Subject: [PATCH 1/1] spi: spi-qpic-snand: make qcom_spi_ecc_engine_ops_pipelined const
Marking the qcom_spi_ecc_engine_ops_pipelined as const provides
memory protection by preventing accidental modification of critical
function pointers at runtime. It also enables memory optimization
by placing the structure in read-only sections and improves code safety
by explicitly documenting the design intent that these operations
should not change after initialization.
Signed-off-by: Can Peng <pengcan@...inos.cn>
---
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 58ceea1ea8fb..7681a91d67d5 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -448,7 +448,7 @@ static int qcom_spi_ecc_finish_io_req_pipelined(struct nand_device *nand,
return snandc->qspi->ecc_stats.bitflips;
}
-static struct nand_ecc_engine_ops qcom_spi_ecc_engine_ops_pipelined = {
+static const struct nand_ecc_engine_ops qcom_spi_ecc_engine_ops_pipelined = {
.init_ctx = qcom_spi_ecc_init_ctx_pipelined,
.cleanup_ctx = qcom_spi_ecc_cleanup_ctx_pipelined,
.prepare_io_req = qcom_spi_ecc_prepare_io_req_pipelined,
--
2.25.1
Powered by blists - more mailing lists