diff mbox series

gpu: ipu-v3: fix refcount leak in ipu_add_client_devices()

Message ID 1670162461-29521-1-git-send-email-wangyufen@huawei.com (mailing list archive)
State New, archived
Headers show
Series gpu: ipu-v3: fix refcount leak in ipu_add_client_devices() | expand

Commit Message

wangyufen Dec. 4, 2022, 2:01 p.m. UTC
The node returned by of_graph_get_port_by_id() with refcount incremented,
of_node_put() needs be called when finish using it. So add it in the
error path in ipu_add_client_devices().

Fixes: 17e052175039 ("gpu: ipu-v3: Do not bail out on missing optional port nodes")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 drivers/gpu/ipu-v3/ipu-common.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 1183185..80587f5 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1164,6 +1164,7 @@  static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
 
 		pdev = platform_device_alloc(reg->name, id++);
 		if (!pdev) {
+			of_node_put(of_node);
 			ret = -ENOMEM;
 			goto err_register;
 		}