Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1637500
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/3] mtdswap: Improve two size determinations in mtdswap_add_mtd() |
| Date | 2017-05-08 17:20 +0200 |
| Message-ID | <tESC6-5Ad-19@gated-at.bofh.it> (permalink) |
| References | <tESsp-5wT-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 16:18:49 +0200
Replace the specification of two data structures by pointer dereferences
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/mtdswap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index 0805f45c5139..f73fb0909b0c 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1485,11 +1485,11 @@ static void mtdswap_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
"%u spare, %u bad blocks\n",
MTDSWAP_PREFIX, part, swap_size / 1024, spare_cnt, bad_blocks);
- d = kzalloc(sizeof(struct mtdswap_dev), GFP_KERNEL);
+ d = kzalloc(sizeof(*d), GFP_KERNEL);
if (!d)
return;
- mbd_dev = kzalloc(sizeof(struct mtd_blktrans_dev), GFP_KERNEL);
+ mbd_dev = kzalloc(sizeof(*mbd_dev), GFP_KERNEL);
if (!mbd_dev) {
kfree(d);
return;
--
2.12.2
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/3] mtdswap: Fine-tuning for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-08 17:10 +0200 [PATCH 1/3] mtdswap: Reduce function calls for sequence output in mtdswap_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-08 17:10 +0200 [PATCH 3/3] mtdswap: Improve a size determination in mtdswap_erase_block() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-08 17:20 +0200 [PATCH 2/3] mtdswap: Improve two size determinations in mtdswap_add_mtd() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-08 17:20 +0200
csiph-web