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

Wang Yufen wangyufen at huawei.com
Sun Dec 4 14:01:01 UTC 2022


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 at huawei.com>
---
 drivers/gpu/ipu-v3/ipu-common.c | 1 +
 1 file changed, 1 insertion(+)

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;
 		}
-- 
1.8.3.1



More information about the dri-devel mailing list