]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: spi-qpic-snand: make qcom_spi_ecc_engine_ops_pipelined const
authorCan Peng <pengcan@kylinos.cn>
Thu, 23 Oct 2025 02:42:50 +0000 (10:42 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 23 Oct 2025 13:10:53 +0000 (14:10 +0100)
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>
drivers/spi/spi-qpic-snand.c

index 58ceea1ea8fb4e02b4c9989a38d1ea38520d88b0..7681a91d67d563fd21fcbd69d223b6e846e97787 100644 (file)
@@ -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,