dmaengine: at_hdmac: Pass residue by address to avoid unnecessary implicit casts
authorTudor Ambarus <tudor.ambarus@microchip.com>
Tue, 25 Oct 2022 09:02:53 +0000 (12:02 +0300)
committerVinod Koul <vkoul@kernel.org>
Fri, 11 Nov 2022 06:45:08 +0000 (12:15 +0530)
commitf5d79afa3a858eb6e5cf2bcd894ed53b5bd8b5ff
tree702ed36ad9beac0b9f97f8318caa1ef76d7955fc
parent0e75c28c52962b528947843e947b4bd0c74d40d2
dmaengine: at_hdmac: Pass residue by address to avoid unnecessary implicit casts

struct dma_tx_state defines residue as u32. atc_get_bytes_left() returned
an int which could be either an error or the value of the residue. This
could cause problems if the controller supported a u32 buffer transfer size
and the u32 value was past the max int can hold. Our controller does not
support u32 buffer transfer size, but even so, improve the code and pass
the residue by address to avoid unnecessary implicit casts and make
atc_get_bytes_left() return 0 on success or -errno on errors.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20221025090306.297886-1-tudor.ambarus@microchip.com
Link: https://lore.kernel.org/r/20221025090306.297886-20-tudor.ambarus@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/at_hdmac.c