Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1615785pxb; Sun, 22 Aug 2021 23:46:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx58PMugCsCu1ZKH8Wfyn7pCzWFdj0L0ktBKVxY0mCtFCNq8sDiOhurtcFgfDjf1CK3Ubt5 X-Received: by 2002:a17:906:6d9:: with SMTP id v25mr34808089ejb.192.1629701211902; Sun, 22 Aug 2021 23:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629701211; cv=none; d=google.com; s=arc-20160816; b=rFN21woziYvimNN0rxc4yD5v5/Uw7KNjfhfeMgkvcbdGXyK7XWyro5fKNlQO5tmBkd NFzxhkGWpljWifxhtaqRNJzVRvoBWwED0siViaVqcjqLfeaX0aN7gZ5sCT/5NsJT6LVB xRq0WU/n9sHq/NlcHoQMz5hVT2ktWQdU1hdPLFjBdR3CkPinv/8DKEZjgREaznv1F5cp l5My+dcpFT6PFFElb9Svsa9ob5jLNb9z1IMcJ20ee2dcCHlz3zbIx4zMO9M+9Gx+2i+s gPs3hK9Nr6E4LdPmxUSM7O5UgoRaKpd+U9wCscko1IT6qhYeH68uB4JmbFFH/q9FE5n0 6uOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FFJ5qArshzVHf3q7jRlOWQagxpfLOrv79VSjCdNEbCA=; b=p7x7m7dtlO0OKUPpLa91PjoFxxlE4qzzg0+yIzmL5qDxELe2GDEXZYgM21DtZbhwr2 IYFFfHSmiKL4nuUwus2UJvbZtdn6EI0zeK5t51btShstVqAPLq/0uX/GEmWM/j7uI74Q syJZUKYFNecZfGqerpcJgzCw7jcSDDTjaQ1BTV5e5njqI15nNdsZI9kAleZi45z/ikAs 9WUPpJjlOj1AzUrKRy5zC5IFuAc8pwDvKu8fd2ef5/V6nr+hlj0wDIXFNfx1Bwdal0RA 0ilpNNb51MwcdeXe3iqSV+pF7paENOQkiBHMWmcXjdthZOvAeYLg/ir7jL4VU3IHM0e8 hzTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Zf7g29E3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si6171497edc.268.2021.08.22.23.46.29; Sun, 22 Aug 2021 23:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Zf7g29E3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234212AbhHWGni (ORCPT + 99 others); Mon, 23 Aug 2021 02:43:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234658AbhHWGnh (ORCPT ); Mon, 23 Aug 2021 02:43:37 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7A2FC061757 for ; Sun, 22 Aug 2021 23:42:54 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id i28so29563585ljm.7 for ; Sun, 22 Aug 2021 23:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FFJ5qArshzVHf3q7jRlOWQagxpfLOrv79VSjCdNEbCA=; b=Zf7g29E3w/mMGEQGTHke0IP1vIqXBP/xGjiHyLab7RfdnbLe9ZNKiyevv6kO2oi89n 3wsWr3eIiIFkS8ODwd2HPqhiTr/XmNhM2RqeP8M7oo/E8+KI1mkd/dwW5x0YHqVVg7ii Gbc8dt9O4AM7OBaotSD53oVjK7yj0Ezk2OaJg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FFJ5qArshzVHf3q7jRlOWQagxpfLOrv79VSjCdNEbCA=; b=PeQWPTZyullx0GFLvdRC90JAgwTYT3QnmmSzRyjEpXOYg31g0MOFryxjyLedOhjJWK 5syFGwiAyUduiKY8UDw3ZP7tKKRByvGcvomtk3e3htCu7PDaRYMJqsI0+PC2Z19jCePM WU34ocSNY15xFSSoxPOQdby15/o6SOBwaEREeuxnOk+/3ktyFKP1HNehCOU2kE/5HFlm 4XWtez5Y+HAlFf6lPwGtz3qZXkSQDxtjTXXGJlzkwZ6a80wkfe8ehSwlQBzvdcCDDTmE 3dBzB1eu1Z7iOEsz5d827swbnJJ3eGyMWuPtMm8aRyTVo3Wz1/nrgThxvC7bsa5g6pwn l/qA== X-Gm-Message-State: AOAM5309izTuVeOsY6AFNZSxt1xJElqK7Pxf5kECjJurXOwPH63DXbWl /EXKLMnzRawVe0zio7/gocoo87aqrwwFlbKOMdJflQ== X-Received: by 2002:a05:651c:211a:: with SMTP id a26mr12902308ljq.305.1629700973307; Sun, 22 Aug 2021 23:42:53 -0700 (PDT) MIME-Version: 1.0 References: <20210820111504.350-1-chun-jie.chen@mediatek.com> <20210820111504.350-6-chun-jie.chen@mediatek.com> In-Reply-To: <20210820111504.350-6-chun-jie.chen@mediatek.com> From: Chen-Yu Tsai Date: Mon, 23 Aug 2021 14:42:42 +0800 Message-ID: Subject: Re: [v2 05/24] clk: mediatek: Fix resource leak in mtk_clk_simple_probe To: Chun-Jie Chen Cc: Matthias Brugger , Stephen Boyd , Nicolas Boichat , Rob Herring , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , LKML , "moderated list:ARM/Mediatek SoC support" , linux-clk@vger.kernel.org, Devicetree List , srv_heupstream , Project_Global_Chrome_Upstream_Group Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 20, 2021 at 7:19 PM Chun-Jie Chen wrote: > > Release clock data when clock driver probe fail to fix > possible resource leak. > > Signed-off-by: Chun-Jie Chen Reviewed-by: Chen-Yu Tsai > --- > drivers/clk/mediatek/clk-mtk.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c > index c3d385c0cfcb..74890759e98c 100644 > --- a/drivers/clk/mediatek/clk-mtk.c > +++ b/drivers/clk/mediatek/clk-mtk.c > @@ -314,7 +314,15 @@ int mtk_clk_simple_probe(struct platform_device *pdev) > > r = mtk_clk_register_gates(node, mcd->clks, mcd->num_clks, clk_data); Note for future reference: there is no unregister counterpart for mtk_clk_register_*. > if (r) > - return r; > + goto free_data; > > - return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); > + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); > + if (r) > + goto free_data; > + > + return r; > + > +free_data: > + mtk_free_clk_data(clk_data); > + return r; > } > -- > 2.18.0 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek