From patchwork Tue Feb 13 20:26:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10217503 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 C6E3B601C2 for ; Tue, 13 Feb 2018 20:26:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5F1428EE3 for ; Tue, 13 Feb 2018 20:26:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAAAD28EE7; Tue, 13 Feb 2018 20:26:43 +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=ham 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 4D44D28EE3 for ; Tue, 13 Feb 2018 20:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965668AbeBMU0m (ORCPT ); Tue, 13 Feb 2018 15:26:42 -0500 Received: from mout.web.de ([212.227.15.14]:54703 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965610AbeBMU0l (ORCPT ); Tue, 13 Feb 2018 15:26:41 -0500 Received: from [192.168.1.2] ([78.49.42.52]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MSav6-1fDAA20H8m-00RaZi; Tue, 13 Feb 2018 21:26:34 +0100 Subject: [PATCH 2/2] dma/ppc4xx: Improve a size determination in ppc440spe_adma_alloc_chan_resources() From: SF Markus Elfring To: dmaengine@vger.kernel.org, Dan Williams , Greg Kroah-Hartman , Rob Herring , Vinod Koul Cc: LKML , kernel-janitors@vger.kernel.org References: <4d9b3ca7-e1bd-42f9-5933-550146812f1e@users.sourceforge.net> Message-ID: Date: Tue, 13 Feb 2018 21:26:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <4d9b3ca7-e1bd-42f9-5933-550146812f1e@users.sourceforge.net> Content-Language: en-US X-Provags-ID: V03:K0:/dytd3Ygm+m7e4L94+FKJ10wySgUMj5WZkv4IQUtpaXjsyJ/IHE /4JZlKDYcmAWL8cENVK7NT63K/x0tBtQJguDnTocABTzxix+ZOrSo7crxTQJr7Kr4TpVRRd c8eoNno2bAYB0bJ9a39XriNnyGx1+fdQJ8BwJ4UUXlAKpeub+twRn0iOyGuncXh3XnTjmbL zBzsLgvg/Siu0f3/A7ABg== X-UI-Out-Filterresults: notjunk:1; V01:K0:M1OIfSY7lgU=:BHz7Nvm1l9ffp5FXAEVBT3 +yxsXOLClsvEO4XKwkK1N2XCfXg8JMK5bszbkm5n7Uu+jW/KsZb6/LpRLJBRu3t1JIpe7vcqO IpQH0KRTpgw0AXieY2BMU8ceQAzsJkoI6f/y3nYRRmakMVhfhl7kcDabxjPYecwK1uiNO5/j3 8lxGYVblmCeUMCh++2INJkGvwGfXDI4QGvxiN12iu0Zfe/N1VMfGNwX47WpH3T19ZKzRbVpSM fEQYMxw3XnthXpLH8rwIPMz8p2CYBKmqywLQvIIbTs9FgJOv4saz74mJGEpai6aORP1c4xmVl EJvTxOEuTh/3YvhQy8BV/bMvgrhBpMHKGeJC/shwDKRzNzfar5AjQNmPjKg2x8TknGj+2pwJu DBpXwMZgTfEK65/x+tc19G6+yH9tlR8bCX9zrngFJz0ObFVRZNSKf1DNqkKND5vF6uY6OGBtM +xTic1At9aUV3MebpX74TN12Cq93pOa+tIby5dsJQoG7ZFMU/dn+2mKfFZgphPkuRQ0j8A08G TjdH+2ej3dNK2C6kyKcldl+x5QD3MsXCxVBMz5iX7JyPy8jgp5mNZVbuQ2zphXOsFNWWxFNJG CpO9xKuL5Zm6tquQO1ZNk9DbzXnLqH9FzMbXTvAAsqZ3orzWjSIY2cyw6EZFpWuQXmfaVB3JV HSCrw7IvjVrq9ul1mc02tArZsGc0xY7ArG5475LVmqWIIscuGXj8Ln81vnYMMIWEGeX45pzxs kWcIiolmYAmWntBia25HDe2Keh1cVYQGamt3QCXwwI1G/+A2WZZf1P+3pb9E3FqUSCULGNxns azXgv5l4w0cWO5upYf8QSUOzONwI1g7NuXGQwjhfvfvF/9OI+A= 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: Tue, 13 Feb 2018 20:54:30 +0100 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/dma/ppc4xx/adma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index f4033367d59b..27ea48a2c1dc 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c @@ -1795,8 +1795,7 @@ static int ppc440spe_adma_alloc_chan_resources(struct dma_chan *chan) db_sz = sizeof(struct xor_cb); for (; i < (ppc440spe_chan->device->pool_size / db_sz); i++) { - slot = kzalloc(sizeof(struct ppc440spe_adma_desc_slot), - GFP_KERNEL); + slot = kzalloc(sizeof(*slot), GFP_KERNEL); if (!slot) { printk(KERN_INFO "SPE ADMA Channel only initialized" " %d descriptor slots", i--);