Commit 2b04bd4f authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Paolo Abeni

dpaa2-ptp: Fix refcount leak in dpaa2_ptp_probe

This node pointer is returned by of_find_compatible_node() with
refcount incremented. Calling of_node_put() to aovid the refcount leak.

Fixes: d346c9e8 ("dpaa2-ptp: reuse ptp_qoriq driver")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220404125336.13427-1-linmq006@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent e3d37210
...@@ -167,7 +167,7 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev) ...@@ -167,7 +167,7 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev)
base = of_iomap(node, 0); base = of_iomap(node, 0);
if (!base) { if (!base) {
err = -ENOMEM; err = -ENOMEM;
goto err_close; goto err_put;
} }
err = fsl_mc_allocate_irqs(mc_dev); err = fsl_mc_allocate_irqs(mc_dev);
...@@ -210,6 +210,8 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev) ...@@ -210,6 +210,8 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev)
fsl_mc_free_irqs(mc_dev); fsl_mc_free_irqs(mc_dev);
err_unmap: err_unmap:
iounmap(base); iounmap(base);
err_put:
of_node_put(node);
err_close: err_close:
dprtc_close(mc_dev->mc_io, 0, mc_dev->mc_handle); dprtc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);
err_free_mcp: err_free_mcp:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment