dmaengine: at_hdmac: Return err in case the chan is not free at alloc res time
authorTudor Ambarus <tudor.ambarus@microchip.com>
Thu, 23 Jan 2020 14:03:06 +0000 (14:03 +0000)
committerVinod Koul <vkoul@kernel.org>
Tue, 25 Feb 2020 05:57:27 +0000 (11:27 +0530)
commitad16bc232dd72f85984c790e07c69009b7c850c8
tree5bbe4d155f66038df71ac4f10309e776816cafbe
parentbbc58394d81110f76586d3053fd5a3a3ad616050
dmaengine: at_hdmac: Return err in case the chan is not free at alloc res time

Having a list of descriptors allocated for the channel at
device_alloc_chan_resources() time is a sign for bad free usage.
Return err and add a debug message in case the channel is not
free from a previous use.

atchan->descs_allocated becomes useless, get rid of it. More,
drop the error message in atc_desc_get() because now it would
introduce an extra if statement. The callers of atc_desc_get()
already print error messages in case the callee fails, no one
is hurt.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Link: https://lore.kernel.org/r/20200123140237.125799-3-tudor.ambarus@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/at_hdmac.c
drivers/dma/at_hdmac_regs.h