From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751345AbdJDSqb (ORCPT ); Wed, 4 Oct 2017 14:46:31 -0400 Received: from mout.web.de ([212.227.15.3]:56982 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbdJDSq3 (ORCPT ); Wed, 4 Oct 2017 14:46:29 -0400 Subject: [PATCH 2/5] cris: nand: Improve a size determination in crisv32_nand_flash_probe() From: SF Markus Elfring To: linux-cris-kernel@axis.com, Alexander Sverdlin , Boris Brezillon , Gregory Clement , Jesper Nilsson , Krzysztof Halasa , Mikael Starvik , Neil Armstrong , Shawn Guo , Tony Lindgren , Vladimir Zapolskiy Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Wed, 4 Oct 2017 20:46:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:0oF/M0P7oeUpmjFzHdP1VUmW/6dugd8lH3biZ4hj6kQpgfOlovW Ix5JoG3VvKhQyjHaK9gd82O+pDcWK2RRcH98Xg0HJZDghymZVGeahX3/SJpHw30jlKruFgR jY8wjyizJuh6egJbDh323/hKRf+SEvg/3oeWtFpd/0X7PERKZCHjJkf1CqGzFDTMerc5SVh u5uZoHjB/5sgGtS0n/IEA== X-UI-Out-Filterresults: notjunk:1;V01:K0:NIfRZXyiagc=:oH4u7SPqp4iH3Ztlp9ub6y MvAtk/ULA9WLdteMsihfyY1py5nxug6bbxi31eo+4Wf3bSIzZ2BHNqrbk4NYGddKPDO7EpKN2 A8yt4U7QgJVmzUwclv7C06OrxOGSXD4bEfUeUiIon+MSWIvfncWFKkOL6GbTY7ppXcQpevIwA 6prWwX2RjjEp/lIUI80qwS30Frr+TfYrsEvwNQSVs2oFQG3XYIwQfkfvDRJBLkTc7jlx92S+b KBt5bd8vJLwb24/+sZN27jqMwSG7593LB50N4qSqxooioofcc+Y7agJQ7EoAHLd4lFfLJA1HO GhwiCKdoPc/NYBrc4P9zjLpouBYk9UTYk5SFXY7KbWMQWQueEl9Aa5G1ulK2Mq7vTPSLdYTIb ExxvyStKSWNWIy90I6r1oKOpPcymMqlChSv83hll5NAYuv5nETOZP77g9wR96OoelRL9MHlGC Clss0YLVXW/5WjgacIsRp8+vKQVnsjdh34923BlusUDae7uDfaUQ/fUyjzVveDZBrqJaktC3E FmSkgKF4GQkoQrqqKhTh23imYJ5atyhxs/DkKX+Xebn2sf+UFnswdUjpOzDOrSM0MllvDNB+t aKIDcUQbLUvtvLe5O49ck2FZuJx1PdyklkCCBlLOIXVaHF9gHYYzUoCBZUMps1uSkTdCpfubS CdDJCeDPEmYAKXVFGHP1H9nuq+vMKNQWPGcrKK8cT8xdFU6+nACw7qq8WtIbPf7r+8kox8E0J ImSlTW645uAt8OwTy+WXIhL88uqEUEDfSFpeDHVjl59jfaoiMV4W4YkByyAv97ZCX1rhbWlXP 48MJqs2WcNpkFSgWGAW6m36M7sgGWadujh+KNFPhMI09MNU2ec= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Wed, 4 Oct 2017 18:00:33 +0200 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 --- arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 2 +- arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c index 259aa1f46fbe..3b5be9b984b4 100644 --- a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c +++ b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c @@ -134,7 +134,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void) REG_WR(pio, regi_pio, rw_oe, oe); /* Allocate memory for MTD device structure and private data */ - wrapper = kzalloc(sizeof(struct mtd_info_wrapper), GFP_KERNEL); + wrapper = kzalloc(sizeof(*wrapper), GFP_KERNEL); if (!wrapper) { err = -ENOMEM; return NULL; diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c index 1baf16ee74e8..5dfd72a89b8a 100644 --- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c +++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c @@ -109,7 +109,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void) int err = 0; /* Allocate memory for MTD device structure and private data */ - wrapper = kzalloc(sizeof(struct mtd_info_wrapper), GFP_KERNEL); + wrapper = kzalloc(sizeof(*wrapper), GFP_KERNEL); if (!wrapper) { err = -ENOMEM; return NULL; -- 2.14.2