From patchwork Wed Jan 31 18:09:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10194333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4BA8260380 for ; Wed, 31 Jan 2018 18:10:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19FE728771 for ; Wed, 31 Jan 2018 18:10:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E78C287A8; Wed, 31 Jan 2018 18:10:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3D1428771 for ; Wed, 31 Jan 2018 18:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FmK3Jh30z9fTFEzG7WFz1xN+7qoL9VMy6gkqxPmpE9E=; b=Dlg9zWkKtArOuFV+rUE4+2FrZr 8XuM7EC6RTwquSpTMFS+lt/MyaE1FOqYy5RoD1zVXL0/0Ux3yn42VMUWgyBPBUJV5BcV0AU/AHI5w gzIxHVyjOg3Kttp8fNpl+StoDQqaTAG7ycWGdbD53/Ih4sV3ikjmNgP7BklN/AiNri3nsC72L+b/L huT2FFa2pNHuuD5CuLzriCyL/Mb8VsEwH3KCN8/oODDRJUMLyhjJN1z4xD3/SiBo3nDKS7YHblxVL pSHU6yjjUaHJG9CbKrArBjNeG1vGSn6ugXZ9WnRIGOY2YLIWNrT405xwq6G/cVtmQD8q2rbpmvfBJ TYIqhD8Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1egwq1-0001sl-Qy; Wed, 31 Jan 2018 18:10:25 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1egwpj-0000KZ-OZ for linux-amlogic@lists.infradead.org; Wed, 31 Jan 2018 18:10:14 +0000 Received: by mail-wr0-x242.google.com with SMTP id 41so14619965wrc.9 for ; Wed, 31 Jan 2018 10:09:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kg4knKPYuyfm2wSCNCd9l37IBCqO4HHAqckRn+WQIUk=; b=jhybDWDjdCIHsdRD9Fa5MSEf0qFm92v5rggsoHriizjxQUmgY3VrZk6sABt08PNAV6 l2l3xcbv1/SqOrxaRD3O4XOGPmFtRDh826Me8gPyWeZ9biqZmesa9aL72IwW8yyiB13X b912640PXIBn/RI3xQGrGwm9U1Q9GAgpJdA5lqiNl4GnJR7DoHJtRaHFUrcsQhsN6Cbe zjdptL0BMRIxjARuqR8KubmKjycMmF2IGCCcnGDGN6jcjHBtJKzFeeMeSk61QjChixkV FHfntU/Ya5rAD+1VtrF4y1S38+lwoKvmxN1rPGCiOr/briyFfumlrfn2+m7remfabAYX 4csg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kg4knKPYuyfm2wSCNCd9l37IBCqO4HHAqckRn+WQIUk=; b=E1QsWbij02ffxnXmmkl+bGPB3K8Kqjt8xUDp0zIgg5z+U8QES4Wos+4PvOC7DfVoOl O76D7GUIplNFLof3H6jmJ84RZC+7KSKtJZjqC+IWWIbJWJyL2xNaRmSrpx37mSWhJirN tynL27stixSV1dasXmz7Q9DHs9r6EufCNVag/hRCl5fQdbrIQmTzB61oQDkjKw1sngPp 2Wm99FV8GdqneGlwIUIEgADnyUZU1g24rsU1uFUhstzHjgn7Mk1O0wqhulAKXyE/4+iO vZbfc1WQLl0uvqv6TIuEPEs1jupIVaNUoanwNqK/MmVkp7ivCDDKeX/8dEoWlrD+TtyK nZgA== X-Gm-Message-State: AKwxytdylPX6rGwYQJzoFu/sD8rE2x6bEX8PQG5NLFX8/+ZmQ+tbjr2A VxZ9/5CzUtC0hxkBBmN9WllSWA== X-Google-Smtp-Source: AH8x226fBzDWlEGnrCMT2JHGF6Psg0FnKlNOgqg0WcFyTPMTpxVVTrkOodxUkwpl6TufybUngfyx5g== X-Received: by 10.223.187.20 with SMTP id r20mr29144564wrg.115.1517422191687; Wed, 31 Jan 2018 10:09:51 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id f8sm341977wmc.3.2018.01.31.10.09.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jan 2018 10:09:51 -0800 (PST) From: Jerome Brunet To: Neil Armstrong , Kevin Hilman Subject: [PATCH 02/19] clk: meson: use devm_of_clk_add_hw_provider Date: Wed, 31 Jan 2018 19:09:28 +0100 Message-Id: <20180131180945.18025-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180131180945.18025-1-jbrunet@baylibre.com> References: <20180131180945.18025-1-jbrunet@baylibre.com> X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, Carlo Caione , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There is no remove callbacks in meson's clock controllers and of_clk_del_provider is never called if of_clk_add_hw_provider has been executed, introducing a potential memory leak. Fixing this by the using the devm variant. In reality, the leak would never happen since these controllers are never unloaded once in use ... still, this is worth cleaning. Signed-off-by: Jerome Brunet --- drivers/clk/meson/axg.c | 4 ++-- drivers/clk/meson/gxbb.c | 5 +++-- drivers/clk/meson/meson8b.c | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 0db0fc0762e2..2f2b3845c01d 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -854,8 +854,8 @@ static int axg_clkc_probe(struct platform_device *pdev) } } - return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, - clkc_data->hw_onecell_data); + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, + clkc_data->hw_onecell_data); } static struct platform_driver axg_driver = { diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 423abcb8ef88..17f44ac751b3 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -2002,8 +2002,9 @@ static int gxbb_clkc_probe(struct platform_device *pdev) goto iounmap; } - return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, - clkc_data->hw_onecell_data); + + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, + clkc_data->hw_onecell_data); iounmap: iounmap(clk_base); diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 3ffea80c1308..abac079ff77f 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -878,8 +878,8 @@ static int meson8b_clkc_probe(struct platform_device *pdev) return ret; } - return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, - &meson8b_hw_onecell_data); + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, + &meson8b_hw_onecell_data); } static const struct of_device_id meson8b_clkc_match_table[] = {