From patchwork Fri Jan 5 00:38:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 10145885 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 080E460244 for ; Fri, 5 Jan 2018 00:43:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FC3B28882 for ; Fri, 5 Jan 2018 00:43:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 333C828885; Fri, 5 Jan 2018 00:43:50 +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 DF2A328882 for ; Fri, 5 Jan 2018 00:43:49 +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=9jl/Jjm/pQr3hcWiSpsh+7CCwfvGcIPhrjMe6tPJL2A=; b=K/+XytUNixFz9GtzFoW2jpW2IE MbGz6fYUs0o1Is5kkDXDG9s4qO3/baCUVuJ0yZKYiuHU2IA8Vig5NEeG0sEm06pV63BKR42oDeD1f KqY0eO2E4hHJuCXiIVwFgMh95Dku2wayTJa47hZr8NrauwHOzaZ6RWSizhJ8Z7YEoeGlpSTJdqwq6 UctA0DaqW6mjY3qZxL9WLRI4s5Q4LQYgAYa4bsbvHhHAJpQIls8ywWMwsrqfYEtJWBtOmCACxkqCV l1qcPfVg43tibXfrbYxuLPxX4nc0xdQ5IyDC692YvZTTjrceyzYEVC4XIUFR/yfongRE6PpfPUsXy 8vZ9aMWw==; 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 1eXG6r-0003lq-Ja; Fri, 05 Jan 2018 00:43:45 +0000 Received: from vern.gendns.com ([206.190.152.46]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eXG46-0001um-Il; Fri, 05 Jan 2018 00:41:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4Q9G8g0pmUbd2NDGlYgsZXi/p6YXVE0HyizjGD6D/A4=; b=xA9xOXKM25wPo/3/M2KDbJgfx DvaZSgWGVu/6Jp2v36F1b8ZtsONrMLP5mFgT7bhsZ4pFHfM49Id45WAxIyzBsnX2Ffjf+lzaQsYq3 67H4s8o8j2Pxdb7iZLDp148B5rD9Q4HJ0acxrFMK9nS8SzGX/+J6N0M9tMfxCb4XVemDlbPam8U2+ uc2UR0tkDZnRGUP2iTKca6OGp8lLo0DXRo9fKbElHHExNOAmD0wwEwNtPbPE9bXIOiOEPODY7C9Sa /XXKMferBURm8BA3M0DSICTQ94ut5XyqMxez8CRBfD0izvvR6xAW9/PCSkIB2/d3N3G9K+kNySut8 A3CFenmGQ==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:37626 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89) (envelope-from ) id 1eXG3r-003bYU-AI; Thu, 04 Jan 2018 19:40:39 -0500 From: David Lechner To: linux-clk@vger.kernel.org Subject: [PATCH 3/7] clk: qoriq: make use of clk_alloc_onecell_data() Date: Thu, 4 Jan 2018 18:38:08 -0600 Message-Id: <1515112695-3160-4-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515112695-3160-1-git-send-email-david@lechnology.com> References: <1515112695-3160-1-git-send-email-david@lechnology.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180104_164055_407495_1DFC8213 X-CRM114-Status: UNSURE ( 6.54 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Lechner , =?UTF-8?q?Emilio=20L=C3=B3pez?= , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Chen-Yu Tsai , linux-mediatek@lists.infradead.org, Matthias Brugger , Maxime Ripard , linux-arm-kernel@lists.infradead.org, Heiko Stuebner MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use helper function clk_alloc_onecell_data() to allocate struct clk_onecell_data. Signed-off-by: David Lechner --- drivers/clk/clk-qoriq.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 3a1812f..5278cc7 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -1175,13 +1175,11 @@ static void __init legacy_pll_init(struct device_node *np, int idx) count = of_property_count_strings(np, "clock-output-names"); BUILD_BUG_ON(ARRAY_SIZE(pll->div) < 4); - subclks = kcalloc(4, sizeof(struct clk *), GFP_KERNEL); - if (!subclks) + onecell_data = clk_alloc_onecell_data(4); + if (!onecell_data) return; - onecell_data = kmalloc(sizeof(*onecell_data), GFP_KERNEL); - if (!onecell_data) - goto err_clks; + subclks = onecell_data->clks; if (count <= 3) { subclks[0] = pll->div[0].clk; @@ -1194,7 +1192,6 @@ static void __init legacy_pll_init(struct device_node *np, int idx) subclks[3] = pll->div[3].clk; } - onecell_data->clks = subclks; onecell_data->clk_num = count; rc = of_clk_add_provider(np, of_clk_src_onecell_get, onecell_data); @@ -1206,9 +1203,7 @@ static void __init legacy_pll_init(struct device_node *np, int idx) return; err_cell: - kfree(onecell_data); -err_clks: - kfree(subclks); + clk_free_onecell_data(onecell_data); } /* Legacy node */