Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557344

[PATCH 3/3] mtd/ftl: Improve another size determination in ftl_add_mtd()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 3/3] mtd/ftl: Improve another size determination in ftl_add_mtd()
Date 2017-01-12 11:50 +0100
Message-ID <sYL7c-2TT-21@gated-at.bofh.it> (permalink)
References <sYKXw-2QD-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 12 Jan 2017 11:18:59 +0100

Replace the specification of a data type 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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mtd/ftl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 7af23110be6e..70d583aa44ad 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -1041,7 +1041,7 @@ static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
 {
 	partition_t *partition;
 
-	partition = kzalloc(sizeof(partition_t), GFP_KERNEL);
+	partition = kzalloc(sizeof(*partition), GFP_KERNEL);
 	if (!partition)
 		return;
 
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] MTD-FTL: Fine-tuning for two function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-12 11:40 +0100
  [PATCH 1/3] mtd/ftl: Use kmalloc_array() in build_maps() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-12 11:40 +0100
    Re: [PATCH 1/3] mtd/ftl: Use kmalloc_array() in build_maps() Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2017-01-12 14:10 +0100
      Re: mtd/ftl: Use kmalloc_array() in build_maps() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-12 18:00 +0100
        Re: mtd/ftl: Use kmalloc_array() in build_maps() Marek Vasut <marek.vasut@gmail.com> - 2017-01-12 18:00 +0100
  [PATCH 2/3] mtd/ftl: Delete an error message for a failed memory  allocation in ftl_add_mtd() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-12 11:40 +0100
  [PATCH 3/3] mtd/ftl: Improve another size determination in  ftl_add_mtd() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-12 11:50 +0100

csiph-web