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: 128144 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3296988ljc; Mon, 12 Feb 2018 07:07:26 -0800 (PST) X-Google-Smtp-Source: AH8x224cbfQ5OVyeuWQZbrZu+1kinORsAsHNiWKRRYg4C7/VKbbtYPKeOJ7ykcy/MW/m35r1VV64 X-Received: by 10.99.126.24 with SMTP id z24mr5521044pgc.343.1518448046566; Mon, 12 Feb 2018 07:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518448046; cv=none; d=google.com; s=arc-20160816; b=I3oxodlRTQzX5v9RaoJwxd+s49F1oJU5nv95kntxYvBzFzyT7Joaaglt8AmcSXGu/y yHmIJikFeELBGM6/HNmVT7Z4YtBEhjDqszhFiS2rg286H4R5uI5lMC2lL/0Iwu4XIeXU O7nsFQbDVa4e9/Ak/Ut9mQhomy7GIIChbofDwfrf8l4vkGsCbCsSEMjI4TDrvS3DkSL0 jxRpUTv8s7CAUT7S03gK8oe7afaI95MXmZgu9CshkBhcL29Rk/O42KbUzjT0nRrvgeBh dpUisO2pe8LL3/fpt8p/Za3dxyjU4zaexMW3L9Q7UaXE14uHpiz7D675EcHV/bUjVfRL 0IGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=h6F3IzPOkKRlb+V1rCtm+S2FUtcPurCvSYXUqC/HkFU=; b=J5N8CVYmMDbd9duXhhcwCLER12RKI5g0aB2uhViNvOYCjtjXKx9z4lhOkVVxWiRZUt 8f9/wSsAf7KF4EJvKrOI4ZE8sr07BBFvgqu5gE3oZHZqYzZyAvFar5Qz/jU5YH3zg1et 1uu992NLCzDiHOOJcHbm1ISjuZw2E3AtYDjTdG/4V8IRn831eWNtxYTZkDKuFl5X0v3s CQyWlgEK+Zw9ydNdqr+TuH0QW50TzSp3MmO3thkNDksJqJp+YhgDtXOH4xjsauI6tGVJ QOmyJmMqezvvdCS/n8aGCXsX4+4fCo3QfkZjzVf6u0aU5jbLGsiMCQE6P1Py+GLJXlSc W7Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=AJ/v3QPq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k136si5268776pga.44.2018.02.12.07.07.26; Mon, 12 Feb 2018 07:07:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=AJ/v3QPq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934728AbeBLPHH (ORCPT + 15 others); Mon, 12 Feb 2018 10:07:07 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46310 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932260AbeBLO6x (ORCPT ); Mon, 12 Feb 2018 09:58:53 -0500 Received: by mail-wr0-f195.google.com with SMTP id 34so5237157wre.13 for ; Mon, 12 Feb 2018 06:58:52 -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=PxMbGktks9aDMNYokW6BWKhmQsuSujQXxWqW9F891Lut3R4ob8gHq35HfAP2xMgouP rfoGS+BNVnf0oMROxEdr0+EqFoQ4EenFxEjZyjkpOvoewjnW7cuBQ/FP6Wh3O2ojiBzp EN5WxFLPWWeBo79/JnprTDiU9WDvPhzNhT0RKEjhO4jTYS0ota3bFqhfjXecyX/Cr/Xj JSA8okmY4MpLcSSqvjcBjnfNxLY6UaM4vDGORZUbQHabWzzWZsvzP9q+V1mbAhTqTOyd Bwc/uIRksn9z1GU+Xr4XVsN1NZDM9e/MFqRaDr1DBo8d9ajX1UW+dsDqvuKDkbsjxsMJ 3d7w== X-Gm-Message-State: APf1xPDVm1bXCQGvtHwDH9nRL3PLELKD10lG/DFh1NWfI97UGipoxMjM vouDCcfSnyinXyCoC31BXbVQww== 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 Cc: Jerome Brunet , Stephen Boyd , Michael Turquette , Carlo Caione , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.14.3 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[] = {