lkml.org 
[lkml]   [2022]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 5.15 564/779] ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe
    Hi!
    > From: Miaoqian Lin <linmq006@gmail.com>
    >
    > [ Upstream commit ae4f11c1ed2d67192fdf3d89db719ee439827c11 ]
    >
    > of_parse_phandle() returns a node pointer with refcount
    > incremented, we should use of_node_put() on it when not need anymore.
    > Fix missing of_node_put() in error paths.

    Is this correct?

    > +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c
    > @@ -256,14 +256,16 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)
    > if (!mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) {
    > dev_err(&pdev->dev,
    > "Property 'audio-codec' missing or invalid\n");
    > - return -EINVAL;
    > + ret = -EINVAL;
    > + goto put_node;
    > }
    ...
    > dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
    > __func__, ret);
    >
    > +put_node:
    > of_node_put(platform_node);
    > return ret;
    > }

    In success case, platform_node is stored:

    dai_link->platforms->of_node = platform_node;

    I guess we should not be doing put in that case.

    Best regards,
    Pavel
    --
    DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
    HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2022-08-19 15:18    [W:4.054 / U:0.248 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site