Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6310372d authored by Hiep Cao Minh's avatar Hiep Cao Minh Committed by Mark Brown
Browse files

spi: rspi: Re-do the returning value of rspi_dma_check_then_transfer



To reduce indentation and complexity of code, insteeds of returning zero
the function rspi_dma_check_then_transfer should return rspi_dma_transfer
directly after checking error.

Signed-off-by: default avatarHiep Cao Minh <cm-hiep@jinso.co.jp>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8634dafa
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -665,15 +665,12 @@ static bool rspi_can_dma(struct spi_master *master, struct spi_device *spi,
static int rspi_dma_check_then_transfer(struct rspi_data *rspi,
					 struct spi_transfer *xfer)
{
	if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
	if (!rspi->master->can_dma || !__rspi_can_dma(rspi, xfer))
		return -EAGAIN;

	/* rx_buf can be NULL on RSPI on SH in TX-only Mode */
		int ret = rspi_dma_transfer(rspi, &xfer->tx_sg,
	return rspi_dma_transfer(rspi, &xfer->tx_sg,
				xfer->rx_buf ? &xfer->rx_sg : NULL);
		if (ret != -EAGAIN)
			return 0;
	}

	return -EAGAIN;
}

static int rspi_common_transfer(struct rspi_data *rspi,