lkml.org 
[lkml]   [2022]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 117/159] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe
    Date
    From: Miaoqian Lin <linmq006@gmail.com>

    [ Upstream commit 9c59a01caba26ec06fefd6ca1f22d5fd1de57d63 ]

    pm_runtime_get_sync() will increment pm usage counter.
    Forgetting to putting operation will result in reference leak.
    Add missing pm_runtime_put_sync in some error paths.

    Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)")
    Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
    Link: https://lore.kernel.org/r/20220602030838.52057-1-linmq006@gmail.com
    Reviewed-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/clk/ti/clk-dra7-atl.c | 9 ++++++---
    1 file changed, 6 insertions(+), 3 deletions(-)

    diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c
    index 7d060ffe8975..9b1f9af35a23 100644
    --- a/drivers/clk/ti/clk-dra7-atl.c
    +++ b/drivers/clk/ti/clk-dra7-atl.c
    @@ -249,14 +249,16 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev)
    if (rc) {
    pr_err("%s: failed to lookup atl clock %d\n", __func__,
    i);
    - return -EINVAL;
    + ret = -EINVAL;
    + goto pm_put;
    }

    clk = of_clk_get_from_provider(&clkspec);
    if (IS_ERR(clk)) {
    pr_err("%s: failed to get atl clock %d from provider\n",
    __func__, i);
    - return PTR_ERR(clk);
    + ret = PTR_ERR(clk);
    + goto pm_put;
    }

    cdesc = to_atl_desc(__clk_get_hw(clk));
    @@ -289,8 +291,9 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev)
    if (cdesc->enabled)
    atl_clk_enable(__clk_get_hw(clk));
    }
    - pm_runtime_put_sync(cinfo->dev);

    +pm_put:
    + pm_runtime_put_sync(cinfo->dev);
    return ret;
    }

    --
    2.35.1


    \
     
     \ /
      Last update: 2022-10-24 18:01    [W:2.186 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site