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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Feb 2022 11:03:21 +0000 (12:03 +0100)
commit3e41445287afa3cf6d572778e5aab31d25e60a8d
treefbab6ff1ba2027188395e5d5e53721d0017095f0
parent8641ceb41f3055cabef3a92d63b19aa5ff3437c3
dmaengine: ptdma: Fix the error handling path in pt_core_init()

commit 3c62fd3406e0b2277c76a6984d3979c7f3f1d129 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dma/ptdma/ptdma-dev.c