From patchwork Sat Sep 17 15:12:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9337153 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 6655160839 for ; Sat, 17 Sep 2016 15:13:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56D7C275A2 for ; Sat, 17 Sep 2016 15:13:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B49F28C6E; Sat, 17 Sep 2016 15:13:53 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 039CE275A2 for ; Sat, 17 Sep 2016 15:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752176AbcIQPNd (ORCPT ); Sat, 17 Sep 2016 11:13:33 -0400 Received: from mout.web.de ([217.72.192.78]:53083 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbcIQPNc (ORCPT ); Sat, 17 Sep 2016 11:13:32 -0400 Received: from [192.168.1.2] ([78.48.101.40]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MFc9x-1boJYa2t9x-00EgyN; Sat, 17 Sep 2016 17:12:57 +0200 Subject: [PATCH 06/24] ste_dma40: Replace four kzalloc() calls by kcalloc() in d40_hw_detect_init() To: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dan Williams , Linus Walleij , Vinod Koul References: <566ABCD9.1060404@users.sourceforge.net> <92810066-69b6-94e7-dcec-a28594b1328f@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <4025bbbc-ea7f-3a02-3bd2-dd374720fe37@users.sourceforge.net> Date: Sat, 17 Sep 2016 17:12:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <92810066-69b6-94e7-dcec-a28594b1328f@users.sourceforge.net> X-Provags-ID: V03:K0:XsBtGyNEodAEQYxnYHOSJuJnbpAh9ZiT60kZsHlxn6CROIbIour zoQR526Bc+f9YTereMeClwlJWWfT1XfBng9Wxh4NqWBOMz1W9GXezylf3k2ixH0EKKNYIdw 0fdLhfJa6QyKEEs0y1OwfFU+7jcd98ABkqcG5SKX3CQyAlWQrg8d/YAeaImCB/dWFHffKyF THmMXLpewL4p4izz1OYBg== X-UI-Out-Filterresults: notjunk:1; V01:K0:aBNBTMPloh0=:2l+py5kWDwl/xvARmsgNbT q5ZPpJlu6veymFroqfjBjsDJ48P6BAfGvGZWhPPqTwxEMBKU0sxnklubcnRwdq50n+appYHtw eacfAyn8fhwhi9C/EiFAc2zZZ1MEKCPcXgoplTBhXU0tHuJNzRY92O+wOzjxW2K/KFWFrgPam OQLwd2ZFBoiXhIQQcmvmNoIcnG+9GBVRAWsIlcCSoLQo1YY/Qa54bHvb3Vp5Y3Qw4NhlhksEQ hz9BxWbe+RhBDvCfJzWmaYtH5rTcaBxnIcLYkg7mVwQqsdx6TkoXGuAglnhg/ajhbA8YfWLIU wMHVD/Dvs970u+AQ1199vh9AulTMZuiSgz0vBwpA0y2qKlZLxMTDAgE7MHROjYEwQ5TzLogs0 QoPOdVMl3FalN/NhBv9cd4nPWuMxI0/QHqAzTlys3Q1ZwjE+4Nj01ZzNUwrY6J7TOyLnz1Je6 dkch7VdRyrMW85LnNJEhQyVs/Z8/0rgU4Q/qppqm8eXDMppeEgQgZhMy9Qmfq3B5BAFG+3wZ+ yq1Bs+G7JNGQuczvHkrReuogJAvlCuSpGdd9nWsjR8+CQOk4Pe4WDsyhaU3WEKZo+daNciH5K u8ldU/eMfmqS4laZNRe+jWtuUhumfyqwh6gFHVT6BxATBHctLlVdYFYYfWIH74N4oJGSFTBkI E7df94zYIBbczqZUQiP7Cvc+yRymHfuso3OoJInk1RXTmK56YHIfX08hC1j7bKRpoZZgzWExc ORtN3/9YV7FQhUMaW50RYKjCY+/QqitYHsA6SLfs9N+d70JccpuyTUZSY4i3yudsUh8xN0U1P 9g3XPd0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 17 Sep 2016 09:56:32 +0200 * The script "checkpatch.pl" can point information out like the following. WARNING: Prefer kcalloc over kzalloc with multiply Thus fix the affected source code places. * Replace the specification of data types by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/dma/ste_dma40.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 57d87a8..b5d15a1 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3281,19 +3281,20 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) base->gen_dmac.init_reg_size = ARRAY_SIZE(dma_init_reg_v4a); } - base->phy_res = kzalloc(num_phy_chans * sizeof(struct d40_phy_res), + base->phy_res = kcalloc(num_phy_chans, + sizeof(*base->phy_res), GFP_KERNEL); if (!base->phy_res) goto failure; - base->lookup_phy_chans = kzalloc(num_phy_chans * - sizeof(struct d40_chan *), + base->lookup_phy_chans = kcalloc(num_phy_chans, + sizeof(*base->lookup_phy_chans), GFP_KERNEL); if (!base->lookup_phy_chans) goto failure; - base->lookup_log_chans = kzalloc(num_log_chans * - sizeof(struct d40_chan *), + base->lookup_log_chans = kcalloc(num_log_chans, + sizeof(*base->lookup_log_chans), GFP_KERNEL); if (!base->lookup_log_chans) goto failure; @@ -3304,9 +3305,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) if (!base->reg_val_backup_chan) goto failure; - base->lcla_pool.alloc_map = - kzalloc(num_phy_chans * sizeof(struct d40_desc *) - * D40_LCLA_LINK_PER_EVENT_GRP, GFP_KERNEL); + base->lcla_pool.alloc_map = kcalloc(num_phy_chans + * D40_LCLA_LINK_PER_EVENT_GRP, + sizeof(*base->lcla_pool.alloc_map), + GFP_KERNEL); if (!base->lcla_pool.alloc_map) goto failure;