Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Miaoqian Lin and committed by
Vinod Koul
615a4bfc c132fe78

+4
+4
drivers/dma/ti/dma-crossbar.c
··· 245 245 if (dma_spec->args[0] >= xbar->xbar_requests) { 246 246 dev_err(&pdev->dev, "Invalid XBAR request number: %d\n", 247 247 dma_spec->args[0]); 248 + put_device(&pdev->dev); 248 249 return ERR_PTR(-EINVAL); 249 250 } 250 251 ··· 253 252 dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); 254 253 if (!dma_spec->np) { 255 254 dev_err(&pdev->dev, "Can't get DMA master\n"); 255 + put_device(&pdev->dev); 256 256 return ERR_PTR(-EINVAL); 257 257 } 258 258 259 259 map = kzalloc(sizeof(*map), GFP_KERNEL); 260 260 if (!map) { 261 261 of_node_put(dma_spec->np); 262 + put_device(&pdev->dev); 262 263 return ERR_PTR(-ENOMEM); 263 264 } 264 265 ··· 272 269 dev_err(&pdev->dev, "Run out of free DMA requests\n"); 273 270 kfree(map); 274 271 of_node_put(dma_spec->np); 272 + put_device(&pdev->dev); 275 273 return ERR_PTR(-ENOMEM); 276 274 } 277 275 set_bit(map->xbar_out, xbar->dma_inuse);