From patchwork Mon Feb 12 14:58:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10213149 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 BC67160467 for ; Mon, 12 Feb 2018 14:59:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF1DA28ACA for ; Mon, 12 Feb 2018 14:59:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A40AB28ADA; Mon, 12 Feb 2018 14:59:52 +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 casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07C9428ACA for ; Mon, 12 Feb 2018 14:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=wzetGKOPRdWs2d0D8zGszadBE9nnSnTGOamQB4fBXlk=; b=CIqk9QGIIu0+EVx/C74LxCgLnq RENaUVP8Hlm85/PEvmIQhnG65EsV6ZbOiqngJYso8fTmDKkRUReWoyZaaAZXuRxSj6gHMXXjvlQVd EwlefPMd9hdEp8uMYSAW+xsNLVCc+emDJWpbqW4T9/Rge3siyvSK26BsvAjynorNgrm4hc4b2M7iD 9j9p8+4VLL7SyHOXk6kQR+feUVYGPU4nXVhkWuLtWFnKGFuEJogAkghU/mbZjqYUDS0AyAvSBpe4l /8QOy5V1JK8b3bwOB1/KmG4Fzivh1Ax5qutPfYpna1KKW6XmlNCMxCresIIS9zU9ssjC4r25wYl6d HZMDi66g==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elFa0-0001xz-8Q for patchwork-linux-amlogic@patchwork.kernel.org; Mon, 12 Feb 2018 14:59:40 +0000 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=wzetGKOPRdWs2d0D8zGszadBE9nnSnTGOamQB4fBXlk=; b=WkZckm8XYDDH/5i7zxf1juz/cC L+m5o4gElNYM9iIiYdADhXNST6ccKDk5i5cvVp1daah92RvI2GpP9RLqUIwtx5iISUNX1VMdWJCMb gHhiFM3V1Yph4Fr2i7W9jLchZ1jzlxfHFGZ7mYXimiWRGdkdEyCrE9QIcHdVbjeIZF2kuI0V4yFlO lisZtkcTTcZ2WwDMYXRA7gDcmC5B5HAfN9LagY5VzksADrrnsC8xkt8f7RHx+ZuXS7kchyGXt9XiD tcXt+4Q/PqnsyhVA5cc+RB6hrCj8+1aJvboY+omyuKdhwGRb0M84kdnTHOClcsVsh4HpBBTNDYmAA TJ/LCSIA==; 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 1elFZj-0001Vy-V0; Mon, 12 Feb 2018 14:59:23 +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 1elFZP-000073-JP for linux-amlogic@lists.infradead.org; Mon, 12 Feb 2018 14:59:06 +0000 Received: by mail-wr0-x242.google.com with SMTP id v65so8695886wrc.11 for ; Mon, 12 Feb 2018 06:58: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=h6F3IzPOkKRlb+V1rCtm+S2FUtcPurCvSYXUqC/HkFU=; b=AJ/v3QPqNeUscfPwKXnMHnokU9/P+ziM2tJIrt6A2wye3QlWdeDPqNgB9j1hN7ZG5w dQV3knXtq3GtVgMvJGBF5BPDI/lMfnmX2T/3LS4UttM1icXN2LJ0J0HKQfMwcBbuxxDZ INN4LTquEs9e49cH+W/Z5kYUHldzvzr1buvnWP1EbmNSAxHRkKccdqm4HHqUZyAFL8gh yKuqEoGsdV3Z6CTNftHJHB4HkLoQQaUQf0XL4Vo57+Kk5Ag6pIU40I4txDix7b4OrZ7v 8Zg+DgQzQ4FazNPFCyLRDedUIgRLKtPzML0ZYJKyvJ1PhrgrfrT45poOdM3lkcaeBehi lq4g== 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=h6F3IzPOkKRlb+V1rCtm+S2FUtcPurCvSYXUqC/HkFU=; b=pET0giFqLediyp85GdARkiZE5wo/OornvU1d09FOtbN0rvv/8reXkU0mxsLQZ6x4Hd FuPBpmI3lDziNTu9Zw8ORnK6qBTlrH9odggBcuLwwCOtDn1gD0046z17C59bYUdfIAsn /8w4FQKPV4EZKdDjKBTx4Q3zs6Q5S+WqCF4J5NcwbtZZhlkuR97Eb4mmfW9kV4lLbLG1 4nb5SY3uo9VqUzN43RHrnHu/tDcs+dLcXaWBwZOvJ3u/OZ1hm4Y3HqoOM/0txAXHjhFh QQBv5O/FjcQ4Rppd3Z0O5QDxGqQ/gn5jfYSw80G99Es6mND2nhgQzpYmsgeEqHBVhPpr kHww== X-Gm-Message-State: APf1xPAmjwc4uYMQV21PS5XGx8pHzuVq4LuxWPx2yNRWElqiPHRWU2sN ML8ipEzZhbylTMl3kyM6vORVcQ== X-Google-Smtp-Source: AH8x2240HKUFfJn06pkPr3y2mlHiXRXynoYUDVDY/ZRExFoOxg15PVQwcwAkGsux3WLfT64r+dD0FQ== X-Received: by 10.223.198.200 with SMTP id c8mr10452307wrh.79.1518447532141; Mon, 12 Feb 2018 06:58:52 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id p21sm4633218wmc.28.2018.02.12.06.58.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 06:58:51 -0800 (PST) From: Jerome Brunet To: Neil Armstrong , Kevin Hilman Subject: [PATCH v2 02/19] clk: meson: use devm_of_clk_add_hw_provider Date: Mon, 12 Feb 2018 15:58:29 +0100 Message-Id: <20180212145846.19380-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180212145846.19380-1-jbrunet@baylibre.com> References: <20180212145846.19380-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 1f48649a7d2a..e16d53b6be30 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[] = {