diff options
| author | Noah.Shen <[email protected]> | 2026-04-06 15:13:30 -0500 |
|---|---|---|
| committer | David Lechner <[email protected]> | 2026-04-28 13:11:19 -0500 |
| commit | 55944a68d550d00df494a5c75685f00cbf0998f0 (patch) | |
| tree | 8ae4ba48f1370783fdb42f268b5ab77c939a6681 | |
| parent | 3b0a037052a24f8449c9fafd02034307e30a3c97 (diff) | |
spi: mtk_snor: check return value of mtk_snor_cmd_exec()
Always check the return value of mtk_snor_cmd_exec() and propagate the
error.
Signed-off-by: Noah.Shen <[email protected]>
Reviewed-by: Julien Stephan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: David Lechner <[email protected]>
| -rw-r--r-- | drivers/spi/mtk_snor.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/spi/mtk_snor.c b/drivers/spi/mtk_snor.c index 674e723db01..babdb4600d5 100644 --- a/drivers/spi/mtk_snor.c +++ b/drivers/spi/mtk_snor.c @@ -362,8 +362,12 @@ static int mtk_snor_pp_buffered(struct mtk_snor_priv *priv, buf[i]; writel(val, priv->base + MTK_NOR_REG_PP_DATA); } - mtk_snor_cmd_exec(priv, MTK_NOR_CMD_WRITE, - (op->data.nbytes + 5) * BITS_PER_BYTE); + + ret = mtk_snor_cmd_exec(priv, MTK_NOR_CMD_WRITE, + (op->data.nbytes + 5) * BITS_PER_BYTE); + if (ret) + return ret; + return mtk_snor_write_buffer_disable(priv); } @@ -386,7 +390,7 @@ static int mtk_snor_cmd_program(struct mtk_snor_priv *priv, int rx_len = 0; int reg_offset = MTK_NOR_REG_PRGDATA_MAX; int tx_len, prg_len; - int i; + int i, ret; void __iomem *reg; u8 val; @@ -435,7 +439,9 @@ static int mtk_snor_cmd_program(struct mtk_snor_priv *priv, /* trigger op */ writel(prg_len * BITS_PER_BYTE, priv->base + MTK_NOR_REG_PRG_CNT); - mtk_snor_cmd_exec(priv, MTK_NOR_CMD_PROGRAM, prg_len * BITS_PER_BYTE); + ret = mtk_snor_cmd_exec(priv, MTK_NOR_CMD_PROGRAM, prg_len * BITS_PER_BYTE); + if (ret) + return ret; /* fetch read data */ reg_offset = 0; |
