From: Liang He Date: Wed, 13 Jul 2022 10:20:13 +0000 (+0800) Subject: ASoC: mt6359: Fix refcount leak bug X-Git-Tag: baikal/mips/sdk5.9~180 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=c51e428e31bd63fc0312d75e9a53d313277e50ed;p=kernel.git ASoC: mt6359: Fix refcount leak bug [ Upstream commit f0b3eaa17aa73307f759d353211a27e497ebcc55 ] 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: e50f23f44fc1 ("ASoC: mt6359: fix failed to parse DT properties") Fixes: ad52183e6765 ("ASoC: mediatek: mt6359: add MT6359 accdet jack driver") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220713102013.367336-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c index 6d3d170144a0a..c190628e29056 100644 --- a/sound/soc/codecs/mt6359-accdet.c +++ b/sound/soc/codecs/mt6359-accdet.c @@ -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; diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c index 2d6a4a29b8507..cf1febe54bcd9 100644 --- a/sound/soc/codecs/mt6359.c +++ b/sound/soc/codecs/mt6359.c @@ -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",