gpu: ipu-v3: common: Add of_node_put() for reference returned by of_graph_get_port_by_id()
Subsystems (2)
PATCH 1/1 gpu: ipu-v3: common: Add of_node_put() for reference returned by of_graph_get_port_by_id()
In ipu_add_client_devices(), we need to call of_node_put() for reference returned by of_graph_get_port_by_id() in fail path.
---
In fact, there may be another problem in following code:
'reg->pdata.of_node = of_node;'
'ret = platform_device_add_data(pdev, ®->pdata,
sizeof(reg->pdata));'
The prolbem is that the 'of_node' will first escape into global 'reg (i.e., client_reg)' and then 'kmemdup' into 'pdev->dev.platform_data', so there are totally two copies of the reference 'of_node'.
I do not know if there is any problems as I do not know the whole picture of 'platform_device_*'.
As a result, I can only give a fix, adding the of_node_put().
drivers/gpu/ipu-v3/ipu-common.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/ipu-v3/ipu-common.c +1 -0
@@ -1165,6 +1165,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) pdev =platform_device_alloc (reg->name, id++);if (!pdev) { ret = -ENOMEM ; +of_node_put (of_node); goto err_register; }
Signature · 1 line
2.25.1
Quoted 5 lines · Liang He
In
ipu_add_client_devices(), we need to callof_node_put()for reference returned byof_graph_get_port_by_id()in fail path.Fixes 17e052175039 ("gpu: ipu-v3: Do not bail out on missing optional port nodes")Signed-off-by Liang He <[email protected]>
regards
Philipp
Quoted 5 lines · Liang He
In
ipu_add_client_devices(), we need to callof_node_put()for reference returned byof_graph_get_port_by_id()in fail path.Fixes 17e052175039 ("gpu: ipu-v3: Do not bail out on missing optional port nodes")Signed-off-by Liang He <[email protected]>
Applied to drm-misc-next.
regards
Philipp