mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
tty: serial: atmel: Check return code of dmaengine_submit()
[ Upstream commit1e67bd2b8c
] The tx_submit() method of struct dma_async_tx_descriptor is entitled to do sanity checks and return errors if encountered. It's not the case for the DMA controller drivers that this client is using (at_h/xdmac), because they currently don't do sanity checks and always return a positive cookie at tx_submit() method. In case the controller drivers will implement sanity checks and return errors, print a message so that the client will be informed that something went wrong at tx_submit() level. Fixes:08f738be88
("serial: at91: add tx dma support") Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Richard Genoud <richard.genoud@gmail.com> Link: https://lore.kernel.org/r/20211125090028.786832-3-tudor.ambarus@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
06d6f69687
commit
cd867ffa14
1 changed files with 10 additions and 0 deletions
|
@ -1002,6 +1002,11 @@ static void atmel_tx_dma(struct uart_port *port)
|
|||
desc->callback = atmel_complete_tx_dma;
|
||||
desc->callback_param = atmel_port;
|
||||
atmel_port->cookie_tx = dmaengine_submit(desc);
|
||||
if (dma_submit_error(atmel_port->cookie_tx)) {
|
||||
dev_err(port->dev, "dma_submit_error %d\n",
|
||||
atmel_port->cookie_tx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
|
||||
|
@ -1262,6 +1267,11 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
|
|||
desc->callback_param = port;
|
||||
atmel_port->desc_rx = desc;
|
||||
atmel_port->cookie_rx = dmaengine_submit(desc);
|
||||
if (dma_submit_error(atmel_port->cookie_rx)) {
|
||||
dev_err(port->dev, "dma_submit_error %d\n",
|
||||
atmel_port->cookie_rx);
|
||||
goto chan_err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue