dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: ti: k3-udma: add missing put_device() call in of_xudma_dev_get()
@ 2020-06-18 13:01 Yu Kuai
  2020-06-24  6:06 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Kuai @ 2020-06-18 13:01 UTC (permalink / raw)
  To: vkoul, dan.j.williams, peter.ujfalusi, grygorii.strashko
  Cc: dmaengine, linux-kernel, yukuai3, yi.zhang

if of_find_device_by_node() succeed and platform_get_drvdata() failed,
of_xudma_dev_get() will return without put_device(), which will leak
the memory.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/dma/ti/k3-udma-private.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-private.c
index 0b8f3dd6b146..77e8e67d995b 100644
--- a/drivers/dma/ti/k3-udma-private.c
+++ b/drivers/dma/ti/k3-udma-private.c
@@ -42,6 +42,7 @@ struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property)
 	ud = platform_get_drvdata(pdev);
 	if (!ud) {
 		pr_debug("UDMA has not been probed\n");
+		put_device(&pdev->dev);
 		return ERR_PTR(-EPROBE_DEFER);
 	}
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: ti: k3-udma: add missing put_device() call in of_xudma_dev_get()
  2020-06-18 13:01 [PATCH] dmaengine: ti: k3-udma: add missing put_device() call in of_xudma_dev_get() Yu Kuai
@ 2020-06-24  6:06 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-06-24  6:06 UTC (permalink / raw)
  To: Yu Kuai
  Cc: dan.j.williams, peter.ujfalusi, grygorii.strashko, dmaengine,
	linux-kernel, yi.zhang

On 18-06-20, 21:01, Yu Kuai wrote:
> if of_find_device_by_node() succeed and platform_get_drvdata() failed,
> of_xudma_dev_get() will return without put_device(), which will leak
> the memory.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-24  6:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 13:01 [PATCH] dmaengine: ti: k3-udma: add missing put_device() call in of_xudma_dev_get() Yu Kuai
2020-06-24  6:06 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).