soc: amlogic: Fix refcount leak in meson-secure-pwrc.c
authorLiang He <windhl@126.com>
Thu, 16 Jun 2022 14:49:15 +0000 (22:49 +0800)
committerNeil Armstrong <narmstrong@baylibre.com>
Fri, 17 Jun 2022 07:40:40 +0000 (09:40 +0200)
In meson_secure_pwrc_probe(), there is a refcount leak in one fail
path.

Signed-off-by: Liang He <windhl@126.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Fixes: b3dde5013e13 ("soc: amlogic: Add support for Secure power domains controller")
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/20220616144915.3988071-1-windhl@126.com
drivers/soc/amlogic/meson-secure-pwrc.c

index a10a417a87db894d8342325ba16986c4e90e7527..e9351876352672f163809b139ccc608589112d66 100644 (file)
@@ -152,8 +152,10 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
        }
 
        pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL);
-       if (!pwrc)
+       if (!pwrc) {
+               of_node_put(sm_np);
                return -ENOMEM;
+       }
 
        pwrc->fw = meson_sm_get(sm_np);
        of_node_put(sm_np);