Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@kylinos.cn>
Link: https://patch.msgid.link/20251023024250.3181084-1-pengcan@kylinos.cn
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Can Peng and committed by
Mark Brown
fd5ef3d6 7c69694c

+1 -1
+1 -1
drivers/spi/spi-qpic-snand.c
··· 448 448 return snandc->qspi->ecc_stats.bitflips; 449 449 } 450 450 451 - static struct nand_ecc_engine_ops qcom_spi_ecc_engine_ops_pipelined = { 451 + static const struct nand_ecc_engine_ops qcom_spi_ecc_engine_ops_pipelined = { 452 452 .init_ctx = qcom_spi_ecc_init_ctx_pipelined, 453 453 .cleanup_ctx = qcom_spi_ecc_cleanup_ctx_pipelined, 454 454 .prepare_io_req = qcom_spi_ecc_prepare_io_req_pipelined,