Skip to content

Commit 615a4bf

Browse files
Yuuoniyvinodkoul
authored andcommitted
dmaengine: ti: Add missing put_device in ti_dra7_xbar_route_allocate
of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Fixes: a074ae3 ("dmaengine: Add driver for TI DMA crossbar on DRA7x") Signed-off-by: Miaoqian Lin <[email protected]> Acked-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent c132fe7 commit 615a4bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/dma/ti/dma-crossbar.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,22 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
245245
if (dma_spec->args[0] >= xbar->xbar_requests) {
246246
dev_err(&pdev->dev, "Invalid XBAR request number: %d\n",
247247
dma_spec->args[0]);
248+
put_device(&pdev->dev);
248249
return ERR_PTR(-EINVAL);
249250
}
250251

251252
/* The of_node_put() will be done in the core for the node */
252253
dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0);
253254
if (!dma_spec->np) {
254255
dev_err(&pdev->dev, "Can't get DMA master\n");
256+
put_device(&pdev->dev);
255257
return ERR_PTR(-EINVAL);
256258
}
257259

258260
map = kzalloc(sizeof(*map), GFP_KERNEL);
259261
if (!map) {
260262
of_node_put(dma_spec->np);
263+
put_device(&pdev->dev);
261264
return ERR_PTR(-ENOMEM);
262265
}
263266

@@ -269,6 +272,7 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
269272
dev_err(&pdev->dev, "Run out of free DMA requests\n");
270273
kfree(map);
271274
of_node_put(dma_spec->np);
275+
put_device(&pdev->dev);
272276
return ERR_PTR(-ENOMEM);
273277
}
274278
set_bit(map->xbar_out, xbar->dma_inuse);

0 commit comments

Comments
 (0)