summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiaoqian Lin <linmq006@gmail.com>2022-06-05 08:27:22 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-12 16:30:50 +0200
commit1be11d7f3c890035aa2620f37dda3c230c9eff09 (patch)
tree9a6b5ca8fd1f02c0f7ef0b6df9775e25b819fcb7
parentb31ab132561c7f1b6459039152b8d09e44eb3565 (diff)
downloadlinux-stable-1be11d7f3c890035aa2620f37dda3c230c9eff09.tar.gz
linux-stable-1be11d7f3c890035aa2620f37dda3c230c9eff09.tar.bz2
linux-stable-1be11d7f3c890035aa2620f37dda3c230c9eff09.zip
dmaengine: ti: Add missing put_device in ti_dra7_xbar_route_allocate
commit 615a4bfc426e11dba05c2cf343f9ac752fb381d2 upstream. of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Fixes: a074ae38f859 ("dmaengine: Add driver for TI DMA crossbar on DRA7x") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com> Link: https://lore.kernel.org/r/20220605042723.17668-1-linmq006@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/dma/ti/dma-crossbar.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c
index d192362e285e..26cf62af08fc 100644
--- a/drivers/dma/ti/dma-crossbar.c
+++ b/drivers/dma/ti/dma-crossbar.c
@@ -247,6 +247,7 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
if (dma_spec->args[0] >= xbar->xbar_requests) {
dev_err(&pdev->dev, "Invalid XBAR request number: %d\n",
dma_spec->args[0]);
+ put_device(&pdev->dev);
return ERR_PTR(-EINVAL);
}
@@ -254,12 +255,14 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0);
if (!dma_spec->np) {
dev_err(&pdev->dev, "Can't get DMA master\n");
+ put_device(&pdev->dev);
return ERR_PTR(-EINVAL);
}
map = kzalloc(sizeof(*map), GFP_KERNEL);
if (!map) {
of_node_put(dma_spec->np);
+ put_device(&pdev->dev);
return ERR_PTR(-ENOMEM);
}
@@ -271,6 +274,7 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
dev_err(&pdev->dev, "Run out of free DMA requests\n");
kfree(map);
of_node_put(dma_spec->np);
+ put_device(&pdev->dev);
return ERR_PTR(-ENOMEM);
}
set_bit(map->xbar_out, xbar->dma_inuse);