memory: renesas-rpc-if: Fix a node reference leak in rpcif_probe()
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Thu, 26 Nov 2020 19:11:44 +0000 (19:11 +0000)
committerKrzysztof Kozlowski <krzk@kernel.org>
Sat, 28 Nov 2020 11:34:57 +0000 (12:34 +0100)
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@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Pavel Machek (CIP) <pavel@denx.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201126191146.8753-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
drivers/memory/renesas-rpc-if.c

index a8d0ba368625e0abaf2f3c18d2ec118c93f6fa32..da0fdb4c759593f11d91a33f5a2a11137000fb37 100644 (file)
@@ -561,9 +561,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)