From patchwork Sun Sep 29 00:37:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2959611 Return-Path: X-Original-To: patchwork-linux-arm@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 61728BFF0B for ; Sun, 29 Sep 2013 00:39:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9121F20237 for ; Sun, 29 Sep 2013 00:39:45 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B14DE20221 for ; Sun, 29 Sep 2013 00:39:44 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQ52k-0007t8-Qf; Sun, 29 Sep 2013 00:39:26 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQ52i-0005Mp-CK; Sun, 29 Sep 2013 00:39:24 +0000 Received: from mail-ee0-x236.google.com ([2a00:1450:4013:c00::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQ52f-0005Lu-MQ for linux-arm-kernel@lists.infradead.org; Sun, 29 Sep 2013 00:39:22 +0000 Received: by mail-ee0-f54.google.com with SMTP id e53so1937459eek.13 for ; Sat, 28 Sep 2013 17:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ERCMwYe7pq3L7lNhXbdd6pCo0S1QT/xqPaka3fIhG6I=; b=hxoGeR6R5ggKjg8LFex1vfy8b/XC4rMnTeCEP8BUjyLAtkxmIgc4ah1/xMNNKFQoYB f13hpF0Vp5MXA6z/BQGLcpx/VWGQF5ZIO3WwG11Dj0P9WYw3cuCECWb0E2PnW5K3iRHB sMyGRG2KaCbNzKzRlKbx8HJhZI3IE4id80vWE90ffLAnY/6IfG+mDFDiPlAxaSe8rH9X UGr8rrrN5hzIrOVTNbOGcrrmBrcySK8wslBK38Obq7IE6VgFnHX85egqMZ8PPXfzroPP 5s+4dGQu7ZJSt16WwYTrrIH91c9dKyXwjd34MXIKuPVcq+bxw/takb8PnS1e6GVR6368 GjdQ== X-Received: by 10.15.67.131 with SMTP id u3mr23577040eex.34.1380415139963; Sat, 28 Sep 2013 17:38:59 -0700 (PDT) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id v8sm33364506eeo.12.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 28 Sep 2013 17:38:59 -0700 (PDT) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] clk: Use kcalloc() to allocate arrays Date: Sun, 29 Sep 2013 02:37:15 +0200 Message-Id: <1380415036-15997-2-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1380415036-15997-1-git-send-email-tomasz.figa@gmail.com> References: <1380415036-15997-1-git-send-email-tomasz.figa@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130928_203921_868106_C85E1CA1 X-CRM114-Status: GOOD ( 11.41 ) X-Spam-Score: -2.0 (--) Cc: Sylwester Nawrocki , Mike Turquette , linux-kernel@vger.kernel.org, Tomasz Figa X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Instead of calculating sizes of arrays manually, kcalloc() can be used to allocate arrays of elements with defined size. This is just a cleanup patch without any functional changes. Signed-off-by: Tomasz Figa --- drivers/clk/clk.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 9e0a837..63f9ac1 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1085,8 +1085,8 @@ static int clk_fetch_parent_index(struct clk *clk, struct clk *parent) int i; if (!clk->parents) { - clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), - GFP_KERNEL); + clk->parents = kcalloc(clk->num_parents, + sizeof(struct clk *), GFP_KERNEL); if (!clk->parents) return -ENOMEM; } @@ -1535,7 +1535,7 @@ static struct clk *__clk_init_parent(struct clk *clk) if (!clk->parents) clk->parents = - kzalloc((sizeof(struct clk*) * clk->num_parents), + kcalloc(clk->num_parents, sizeof(struct clk *), GFP_KERNEL); ret = clk_get_parent_by_index(clk, index); @@ -1692,8 +1692,8 @@ int __clk_init(struct device *dev, struct clk *clk) * for clock drivers to statically initialize clk->parents. */ if (clk->num_parents > 1 && !clk->parents) { - clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), - GFP_KERNEL); + clk->parents = kcalloc(clk->num_parents, sizeof(struct clk *), + GFP_KERNEL); /* * __clk_lookup returns NULL for parents that have not been * clk_init'd; thus any access to clk->parents[] must check @@ -1833,8 +1833,8 @@ static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk) hw->clk = clk; /* allocate local copy in case parent_names is __initdata */ - clk->parent_names = kzalloc((sizeof(char*) * clk->num_parents), - GFP_KERNEL); + clk->parent_names = kcalloc(clk->num_parents, sizeof(char *), + GFP_KERNEL); if (!clk->parent_names) { pr_err("%s: could not allocate clk->parent_names\n", __func__);