Skip to content

Commit

Permalink
spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config()
Browse files Browse the repository at this point in the history
dmaengine_slave_config() may return different error codes based on
the circumstances. Preserve it instead of shadowing to -EINVAL.

Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20240204203127.1186621-2-andy.shevchenko@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
andy.shevchenko@gmail.com authored and Mark Brown committed Feb 5, 2024
1 parent 1e942b5 commit f156743
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/spi/spi-fsl-dspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,13 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
ret = dmaengine_slave_config(dma->chan_rx, &cfg);
if (ret) {
dev_err(dev, "can't configure rx dma channel\n");
ret = -EINVAL;
goto err_slave_config;
}

cfg.direction = DMA_MEM_TO_DEV;
ret = dmaengine_slave_config(dma->chan_tx, &cfg);
if (ret) {
dev_err(dev, "can't configure tx dma channel\n");
ret = -EINVAL;
goto err_slave_config;
}

Expand Down

0 comments on commit f156743

Please sign in to comment.