]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: mt6359: Fix refcount leak bug
authorLiang He <windhl@126.com>
Wed, 13 Jul 2022 10:20:13 +0000 (18:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:42:05 +0000 (14:42 +0200)
[ Upstream commit a8d5df69e2ec702d979f7d04ed519caf8691a032 ]

In mt6359_parse_dt() and mt6359_accdet_parse_dt(), we should call
of_node_put() for the reference returned by of_get_child_by_name()
which has increased the refcount.

Fixes: 683530285316 ("ASoC: mt6359: fix failed to parse DT properties")
Fixes: eef07b9e0925 ("ASoC: mediatek: mt6359: add MT6359 accdet jack driver")
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220713102013.367336-1-windhl@126.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/mt6359-accdet.c
sound/soc/codecs/mt6359.c

index 6d3d170144a0ae35b28068b4d7bd96a40b5897a9..c190628e290566c26e4a56ca702818d7a2f30965 100644 (file)
@@ -675,6 +675,7 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
                               sizeof(struct three_key_threshold));
        }
 
+       of_node_put(node);
        dev_warn(priv->dev, "accdet caps=%x\n", priv->caps);
 
        return 0;
index f8532aa7e4aa03704b03e63232061e0452e61a90..9a9c8555f7204f4ebc82fc614d70e97ec5a61a41 100644 (file)
@@ -2780,6 +2780,7 @@ static int mt6359_parse_dt(struct mt6359_priv *priv)
 
        ret = of_property_read_u32(np, "mediatek,mic-type-2",
                                   &priv->mux_select[MUX_MIC_TYPE_2]);
+       of_node_put(np);
        if (ret) {
                dev_info(priv->dev,
                         "%s() failed to read mic-type-2, use default (%d)\n",