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: 126404 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp972959ljc; Wed, 31 Jan 2018 10:15:45 -0800 (PST) X-Google-Smtp-Source: AH8x224YU/I6cO6nLtG+9dyRWBpuol96kpZXoQPVLBs2q9YyILDSi1PeMqlU1elwiOIO/pWMBwt6 X-Received: by 2002:a17:902:b7cb:: with SMTP id v11-v6mr29377137plz.393.1517422545670; Wed, 31 Jan 2018 10:15:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517422545; cv=none; d=google.com; s=arc-20160816; b=fp8oNnme4XdSIuk3P0Tq1ZrzoQRNL9qkgnzGFc+wnNICzHWyvPyLfA1liUaCXH8RTK Lrc0nqEB7eZGxLBw+uz2MI1Z0HNSU5RREnlyYsTVnoZu68PYPkkrWN4Dq4q/Ysawjl+G oNXZZx1EroCQLVmT4mi1X5TeqOSYUcx6uhjil2LjGBuj4II6GNyPqqObDcucAxPrLurC S1G6u/AA9QWftCTrH+4654zyckmDzz6j82H5U+4VrG50Jw9My5a/4rTgv2BoVlBCIPpS NV2BHS24yuKKiunQGpIr/XqaxI8ofGSk76WJe3iPiGX3ivCNjTyX2NbDG5IxTSwf8Bce qnew== 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=kg4knKPYuyfm2wSCNCd9l37IBCqO4HHAqckRn+WQIUk=; b=wiYlzxO93465SmYR2Js1bZLYbtydwiWXnRn1roFp+otx7ovGc3A5EL86XsDgiu5r5d nKt7rF1VJhsfQU/TNPsRdh9zmzPDb8ZUPoM26rUUlqS3lnhVnefB4R2wDgnJ/3ps9wbD f+ag0myIrrZUk43uRMLXkctqfeAvhfvaNu8PwutXp1NjutSXcd5ZseTCEWEFzgfhsuFI hdQzaE80B1fV6c/VKA3c6PmI3C0q6/VAiXxQ1T8wWnCyL4Hi2au3VdTt5nhjQylaemGU 7cp6mE4n2eEfFtcSElp1jMSdbClalUpc61SSsfsJA5MtAzoQNH7jJy2IM36HnYiHKbjc 3uOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=jhybDWDj; 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 d13si5156777pgu.579.2018.01.31.10.15.45; Wed, 31 Jan 2018 10:15:45 -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=jhybDWDj; 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 S1754063AbeAaSPn (ORCPT + 27 others); Wed, 31 Jan 2018 13:15:43 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:40934 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753484AbeAaSJw (ORCPT ); Wed, 31 Jan 2018 13:09:52 -0500 Received: by mail-wr0-f195.google.com with SMTP id i56so16010940wra.7 for ; Wed, 31 Jan 2018 10:09: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=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=N/VBbaQDhrvHtWLvOvB9BMyo8l6Sj32h7D0xPCH5kVUTJDylWDKFFmSl003T5uDLTj pJeqSUFpcYpQSv9jsn6BnGOvahmvBm3+ELvPuLXOV+U6hekiqMW3WsmwHfsnti24FVOV Db7TfZPleYAm5RrQ+8I6xJ5w7AUn87Oz93jcdjaPB6FssBU1qbXqesSg+m4hzxlyMLUi U0ZCJGebP+wZ4uDZH5k32uk6g4TCoX54tU+uKY7BlhfaHdQIvtW4saeyGUtGKK8O1e5F TmWpzi9JAenoPUf1/ZEW5OQn0j4M83Ntn7ZH20O/SvvRYZh7zq1meYUDbSaY2iLtpCZ2 phOg== X-Gm-Message-State: AKwxytfxRR3kRTG96rR2hLbhs1rpbiDYSVrmCIcldbIqAkQyNmFD0IuW yGjiWHgz5R05ouzDzjfGKF5Epg== 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 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 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> 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 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[] = {