dmaengine: ptdma: Fix the error handling path in pt_core_init()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 5 Feb 2022 06:58:44 +0000 (07:58 +0100)
committerVinod Koul <vkoul@kernel.org>
Tue, 15 Feb 2022 05:17:36 +0000 (10:47 +0530)
commit3c62fd3406e0b2277c76a6984d3979c7f3f1d129
tree4a5c17c93035acd7b1ceb94705def552493ad855
parente783362eb54cd99b2cac8b3a9aeac942e6f6ac07
dmaengine: ptdma: Fix the error handling path in pt_core_init()

In order to free resources correctly in the error handling path of
pt_core_init(), 2 goto's have to be switched. Otherwise, some resources
will leak and we will try to release things that have not been allocated
yet.

Also move a dev_err() to a place where it is more meaningful.

Fixes: fa5d823b16a9 ("dmaengine: ptdma: Initial driver for the AMD PTDMA")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Sanjay R Mehta <sanju.mehta@amd.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/41a963a35173f89c874f5c44df5530dc09fea8da.1644044244.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/ptdma/ptdma-dev.c