[PATCH v3 4.19.y-cip 05/17] memory: renesas-rpc-if: Fix a node reference leak in rpcif_probe()

Lad Prabhakar

commit 4e6b86b409f9fc63fedb39d6e3a0202c4b0244ce upstream.

Release the node reference by calling of_node_put(flash) in the probe.

Fixes: ca7d8b980b67f ("memory: add Renesas RPC-IF driver")
Reported-by: Pavel Machek <pavel@...>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Reviewed-by: Pavel Machek (CIP) <pavel@...>
Cc: stable@...
Link: https://lore.kernel.org/r/20201126191146.8753-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzk@...>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...>
drivers/memory/renesas-rpc-if.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 0d2b0e1c1ba4..1e7b937b739a 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -563,9 +563,11 @@ static int rpcif_probe(struct platform_device *pdev)
} else if (of_device_is_compatible(flash, "cfi-flash")) {
name = "rpc-if-hyperflash";
} else {
+ of_node_put(flash);
dev_warn(&pdev->dev, "unknown flash type\n");
return -ENODEV;
+ of_node_put(flash);

vdev = platform_device_alloc(name, pdev->id);
if (!vdev)

Join {cip-dev@lists.cip-project.org to automatically receive all group messages.