From patchwork Fri Mar 21 12:40:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 3873771 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D1A02BF549 for ; Fri, 21 Mar 2014 12:40:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14F9B2027D for ; Fri, 21 Mar 2014 12:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1602E2028D for ; Fri, 21 Mar 2014 12:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755343AbaCUMkQ (ORCPT ); Fri, 21 Mar 2014 08:40:16 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:53681 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760234AbaCUMkM (ORCPT ); Fri, 21 Mar 2014 08:40:12 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N2S00E0TDUZ3M60@mailout4.w1.samsung.com>; Fri, 21 Mar 2014 12:40:11 +0000 (GMT) X-AuditID: cbfec7f5-b7fc96d000004885-14-532c332b7297 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 74.BD.18565.B233C235; Fri, 21 Mar 2014 12:40:11 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N2S00FW8DUTI000@eusync4.samsung.com>; Fri, 21 Mar 2014 12:40:11 +0000 (GMT) From: Krzysztof Kozlowski To: Mike Turquette , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Tushar Behera , Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Tomasz Figa , Krzysztof Kozlowski Subject: [PATCH-next 2/2] clk: s2mps11: Remove useless check for clk_table Date: Fri, 21 Mar 2014 13:40:03 +0100 Message-id: <1395405603-11772-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1395405603-11772-1-git-send-email-k.kozlowski@samsung.com> References: <1395405603-11772-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHJMWRmVeSWpSXmKPExsVy+t/xa7raxjrBBr8bVS02zljPavH6haHF 2aY37BabHl9jtbi8aw6bxYzz+5gs1h65y27xdMJFNov1M16zWLT/3cvmwOVx59oeNo/NS+o9 +rasYvT4vEkugCWKyyYlNSezLLVI3y6BK2PzoamMBc8FKs493MTSwPiLt4uRk0NCwERi2/uz jBC2mMSFe+vZuhi5OIQEljJKbP3/gw0kISTQxySxf1saiM0mYCyxefkSsCIRgamMEhvXL2IC cZgFJjNJLFt2EGyUsICXROuU5SwgNouAqsSynuvsIDavgLvEl4tPmbsYOYDWKUjMmWQDEuYU 8JB4M3c/O8Qyd4m5B44xTWDkXcDIsIpRNLU0uaA4KT3XSK84Mbe4NC9dLzk/dxMjJMy+7mBc eszqEKMAB6MSD28Fp3awEGtiWXFl7iFGCQ5mJRHenQY6wUK8KYmVValF+fFFpTmpxYcYmTg4 pRoYOdkX21zz52A07piQfvHBnAW+Fqnisn0v1xxUXyGxLmHbikenHDuSVtq/vBg+76vz5uJm 0xlJ0fz6c1X1L6bIhfvnznS+JBRraDl50rxrs5af6v9anb3jWRKjut+3Zytf7zdvq5288I65 x5QFD6X107YJXCsor5557PlGxf7Mk6tWxC2LmeDPrcRSnJFoqMVcVJwIAFsff7sRAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is no need for checking if 'clk_table' is not NULL twice (first after allocation and second at the end of probe()). Also move allocation of this 'clk_table' to probe from s2mps11_clk_parse_dt as this is logical place for it. Signed-off-by: Krzysztof Kozlowski --- drivers/clk/clk-s2mps11.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index 843ec3646501..23ffd89c4023 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -141,11 +141,6 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev) return ERR_PTR(-EINVAL); } - clk_table = devm_kzalloc(&pdev->dev, sizeof(struct clk *) * - S2MPS11_CLKS_NUM, GFP_KERNEL); - if (!clk_table) - return ERR_PTR(-ENOMEM); - for (i = 0; i < S2MPS11_CLKS_NUM; i++) of_property_read_string_index(clk_np, "clock-output-names", i, &s2mps11_clks_init[i].name); @@ -168,6 +163,11 @@ static int s2mps11_clk_probe(struct platform_device *pdev) s2mps11_clk = s2mps11_clks; + clk_table = devm_kzalloc(&pdev->dev, sizeof(struct clk *) * + S2MPS11_CLKS_NUM, GFP_KERNEL); + if (!clk_table) + return -ENOMEM; + /* Store clocks of_node in first element of s2mps11_clks array */ s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev); if (IS_ERR(s2mps11_clks->clk_np)) @@ -220,15 +220,13 @@ static int s2mps11_clk_probe(struct platform_device *pdev) clkdev_add(s2mps11_clk->lookup); } - if (clk_table) { - for (i = 0; i < S2MPS11_CLKS_NUM; i++) - clk_table[i] = s2mps11_clks[i].clk; + for (i = 0; i < S2MPS11_CLKS_NUM; i++) + clk_table[i] = s2mps11_clks[i].clk; - clk_data.clks = clk_table; - clk_data.clk_num = S2MPS11_CLKS_NUM; - of_clk_add_provider(s2mps11_clks->clk_np, - of_clk_src_onecell_get, &clk_data); - } + clk_data.clks = clk_table; + clk_data.clk_num = S2MPS11_CLKS_NUM; + of_clk_add_provider(s2mps11_clks->clk_np, of_clk_src_onecell_get, + &clk_data); platform_set_drvdata(pdev, s2mps11_clks);