mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 17:11:02 +01:00
spi: sg2044-nor: Return transfer errors
The transfer helpers return errors, but both dispatchers discard them.
Return these errors to the SPI memory layer instead of reporting success.
Fixes: de16c322ee ("spi: sophgo: add SG2044 SPI NOR controller driver")
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
Link: https://patch.msgid.link/20261001-fix-sg204xspi-v2-1-014dbaf22b5e@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
853de617c4
commit
53cdc4266b
|
|
@ -307,15 +307,15 @@ static ssize_t sg2044_spifmc_tran_cmd(struct sg2044_spifmc *spifmc,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void sg2044_spifmc_trans(struct sg2044_spifmc *spifmc,
|
||||
const struct spi_mem_op *op)
|
||||
static int sg2044_spifmc_trans(struct sg2044_spifmc *spifmc,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
if (op->data.dir == SPI_MEM_DATA_IN)
|
||||
sg2044_spifmc_read(spifmc, op);
|
||||
return sg2044_spifmc_read(spifmc, op);
|
||||
else if (op->data.dir == SPI_MEM_DATA_OUT)
|
||||
sg2044_spifmc_write(spifmc, op);
|
||||
return sg2044_spifmc_write(spifmc, op);
|
||||
else
|
||||
sg2044_spifmc_tran_cmd(spifmc, op);
|
||||
return sg2044_spifmc_tran_cmd(spifmc, op);
|
||||
}
|
||||
|
||||
static ssize_t sg2044_spifmc_trans_reg(struct sg2044_spifmc *spifmc,
|
||||
|
|
@ -389,19 +389,20 @@ static int sg2044_spifmc_exec_op(struct spi_mem *mem,
|
|||
const struct spi_mem_op *op)
|
||||
{
|
||||
struct sg2044_spifmc *spifmc;
|
||||
int ret;
|
||||
|
||||
spifmc = spi_controller_get_devdata(mem->spi->controller);
|
||||
|
||||
mutex_lock(&spifmc->lock);
|
||||
|
||||
if (op->addr.nbytes == 0)
|
||||
sg2044_spifmc_trans_reg(spifmc, op);
|
||||
ret = sg2044_spifmc_trans_reg(spifmc, op);
|
||||
else
|
||||
sg2044_spifmc_trans(spifmc, op);
|
||||
ret = sg2044_spifmc_trans(spifmc, op);
|
||||
|
||||
mutex_unlock(&spifmc->lock);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct spi_controller_mem_ops sg2044_spifmc_mem_ops = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user