From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1044330AbdDWJIJ (ORCPT ); Sun, 23 Apr 2017 05:08:09 -0400 Received: from mout.web.de ([212.227.15.4]:49774 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1044312AbdDWJHx (ORCPT ); Sun, 23 Apr 2017 05:07:53 -0400 Subject: [PATCH 1/2] dmaengine: k3dma: Use devm_kcalloc() in k3_dma_probe() From: SF Markus Elfring To: dmaengine@vger.kernel.org, Dan Williams , Vinod Koul , Zhangfei Gao Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <3f5acfa7-3c12-e8e1-17dd-ae03ce45c0be@users.sourceforge.net> Date: Sun, 23 Apr 2017 11:07:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:xTmSNiFS2rafHGRx/hTXlVla2zzWz5Y8y6KF5g1f+ajO2n0z0ad +ImWV46nikgOvC3eUb3tYLmFSX0baEzz5U8Q65zXC1Vy8iZRECFQWlsOm7PFMFrZhssZkmz pD10gCaQFZYSqwFbRkD351BcusQ5nisouSuPRrEa9RVzA8h2T5GXifVOAZJpW8970g+tyxJ r08Rw2XH/eLwSuLTjRcOw== X-UI-Out-Filterresults: notjunk:1;V01:K0:O9S8MDLM69Q=:PvTPXh4O+IDTT0mYODiWMn dPsJly6cv8tFs2xKpLK/BXDLK7rmRGvwnNvzDU9gQluCFwlnHijBaBrFj7QO7SMCCZq+pJ21x 0Ch7rZjqMe/BGuBaGKzcz0n5LK5ahShmONWbnvDeEIBLa0s0xAjmGgsAXdGi2TFBJ/lYeQdPn OZjKd6bhEP8TCTqs/4PzIWA2uH6WwvSO/8RO9C4G2etD/Mw66RfIL76LkF9AguoLe7UH+oBTL BjF35mOs02KOrDYXAVopVZq+dt98ZwXYUN7HC9sWsKT0yqTAmvO+C3uGQFHIbb4vVXHVvb3gw +GIFQ5LHoogm+2w7bkOla8tDs6fziR+ihpgy8ObQkRHFF4FRfw1imOr/7fs6HwyWmVoG1HVYV cfAQHj30rhYyEGBtnh2geVCjeuElG3qfVJm3D/VH/7gnWpK+jJfUG2KMzKvbvg0PpGhLNkMGT vY7BEc8gq8Z0auYB4DQuoEOBHzCYteGhk4mD+vfFBLI00+JpPH9Mb4aU0RFoDHD6NSjC1BwHe 0LsxGn2eue1PMSlo+dvvPtA4oh76L0hkQ2093+MzW/8i3oFyjGnWhAs6ArQJd0HSmS1MIsgcC XdUErdGJ6eLnB4JIOJ0glBDPVYLrmTax91/+gLPXlQ9VnsheEgREUAcQ/PvZ0mNJB9zQJhoRU 8gSjoaSfpSXQ9wq0riowRXwtFYhSyUtq+U1rUK3vIPxtWDkHbOIjXAfa8mWWKq559ZwTstKDG DLonz/nDeLec3BtQAyfvYKJE2W05CZppROm6hMSQ0nZi+FedTIcYzFYF4R2QjaOz3qN3hZG41 3A3xmhj Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Sun, 23 Apr 2017 10:30:32 +0200 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "devm_kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data structures 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/k3dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 01e25c68dd5a..31a51ee1a910 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -845,8 +845,8 @@ static int k3_dma_probe(struct platform_device *op) return -ENOMEM; /* init phy channel */ - d->phy = devm_kzalloc(&op->dev, - d->dma_channels * sizeof(struct k3_dma_phy), GFP_KERNEL); + d->phy = devm_kcalloc(&op->dev, d->dma_channels, sizeof(*d->phy), + GFP_KERNEL); if (d->phy == NULL) return -ENOMEM; @@ -875,8 +875,8 @@ static int k3_dma_probe(struct platform_device *op) d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; /* init virtual channel */ - d->chans = devm_kzalloc(&op->dev, - d->dma_requests * sizeof(struct k3_dma_chan), GFP_KERNEL); + d->chans = devm_kcalloc(&op->dev, d->dma_requests, sizeof(*d->chans), + GFP_KERNEL); if (d->chans == NULL) return -ENOMEM; -- 2.12.2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Sun, 23 Apr 2017 09:07:43 +0000 Subject: [PATCH 1/2] dmaengine: k3dma: Use devm_kcalloc() in k3_dma_probe() Message-Id: <3f5acfa7-3c12-e8e1-17dd-ae03ce45c0be@users.sourceforge.net> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: dmaengine@vger.kernel.org, Dan Williams , Vinod Koul , Zhangfei Gao Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring Date: Sun, 23 Apr 2017 10:30:32 +0200 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "devm_kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data structures 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/k3dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 01e25c68dd5a..31a51ee1a910 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -845,8 +845,8 @@ static int k3_dma_probe(struct platform_device *op) return -ENOMEM; /* init phy channel */ - d->phy = devm_kzalloc(&op->dev, - d->dma_channels * sizeof(struct k3_dma_phy), GFP_KERNEL); + d->phy = devm_kcalloc(&op->dev, d->dma_channels, sizeof(*d->phy), + GFP_KERNEL); if (d->phy = NULL) return -ENOMEM; @@ -875,8 +875,8 @@ static int k3_dma_probe(struct platform_device *op) d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; /* init virtual channel */ - d->chans = devm_kzalloc(&op->dev, - d->dma_requests * sizeof(struct k3_dma_chan), GFP_KERNEL); + d->chans = devm_kcalloc(&op->dev, d->dma_requests, sizeof(*d->chans), + GFP_KERNEL); if (d->chans = NULL) return -ENOMEM; -- 2.12.2