diff mbox series

[v3,2/2] dmaengine: ti: edma: fix OF node reference leaks in edma_driver

Message ID 20241219020507.1983124-3-joe@pf.is.s.u-tokyo.ac.jp (mailing list archive)
State New
Headers show
Series dmaengine: ti: edma: fix OF node reference leaks in edma_driver | expand

Commit Message

Joe Hattori Dec. 19, 2024, 2:05 a.m. UTC
The .probe() of edma_driver calls of_parse_phandle_with_fixed_args() but
does not release the obtained OF nodes. Thus add a of_node_put() call.

This bug was found by an experimental verification tool that I am
developing.

Fixes: 1be5336bc7ba ("dmaengine: edma: New device tree binding")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
---
 drivers/dma/ti/edma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Dan Carpenter Dec. 19, 2024, 9:07 a.m. UTC | #1
On Thu, Dec 19, 2024 at 11:05:07AM +0900, Joe Hattori wrote:
> The .probe() of edma_driver calls of_parse_phandle_with_fixed_args() but
> does not release the obtained OF nodes. Thus add a of_node_put() call.
> 
> This bug was found by an experimental verification tool that I am
> developing.
> 
> Fixes: 1be5336bc7ba ("dmaengine: edma: New device tree binding")
> Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
> ---

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
index 08f6c67d381e..4ece125b2ae7 100644
--- a/drivers/dma/ti/edma.c
+++ b/drivers/dma/ti/edma.c
@@ -208,7 +208,6 @@  struct edma_desc {
 struct edma_cc;
 
 struct edma_tc {
-	struct device_node		*node;
 	u16				id;
 };
 
@@ -2466,13 +2465,13 @@  static int edma_probe(struct platform_device *pdev)
 			if (ret)
 				break;
 
-			ecc->tc_list[i].node = tc_args.np;
 			ecc->tc_list[i].id = i;
 			queue_priority_mapping[i][1] = tc_args.args[0];
 			if (queue_priority_mapping[i][1] > lowest_priority) {
 				lowest_priority = queue_priority_mapping[i][1];
 				info->default_queue = i;
 			}
+			of_node_put(tc_args.np);
 		}
 
 		/* See if we have optional dma-channel-mask array */