diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-01-08 15:25:44 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-02-13 07:20:10 -0500 |
commit | 554d7c540ea0d30e03674a24d139dd8b5c1646c5 (patch) | |
tree | 8ab9104b4e7f8d978bac25698b08be53b0d81caa /drivers/mmc/core/mmc_test.c | |
parent | 7200449dc6a1f4556ad5da20df031bfbaf42fff5 (diff) |
mmc: mmc_test: Improve a size determination in five functions
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/mmc_test.c')
-rw-r--r-- | drivers/mmc/core/mmc_test.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 5c74fb4dfee6..7784cce56895 100644 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c | |||
@@ -356,7 +356,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz, | |||
356 | if (max_segs > max_page_cnt) | 356 | if (max_segs > max_page_cnt) |
357 | max_segs = max_page_cnt; | 357 | max_segs = max_page_cnt; |
358 | 358 | ||
359 | mem = kzalloc(sizeof(struct mmc_test_mem), GFP_KERNEL); | 359 | mem = kzalloc(sizeof(*mem), GFP_KERNEL); |
360 | if (!mem) | 360 | if (!mem) |
361 | return NULL; | 361 | return NULL; |
362 | 362 | ||
@@ -545,7 +545,7 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test, | |||
545 | if (!test->gr) | 545 | if (!test->gr) |
546 | return; | 546 | return; |
547 | 547 | ||
548 | tr = kmalloc(sizeof(struct mmc_test_transfer_result), GFP_KERNEL); | 548 | tr = kmalloc(sizeof(*tr), GFP_KERNEL); |
549 | if (!tr) | 549 | if (!tr) |
550 | return; | 550 | return; |
551 | 551 | ||
@@ -2973,8 +2973,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase) | |||
2973 | } | 2973 | } |
2974 | } | 2974 | } |
2975 | 2975 | ||
2976 | gr = kzalloc(sizeof(struct mmc_test_general_result), | 2976 | gr = kzalloc(sizeof(*gr), GFP_KERNEL); |
2977 | GFP_KERNEL); | ||
2978 | if (gr) { | 2977 | if (gr) { |
2979 | INIT_LIST_HEAD(&gr->tr_lst); | 2978 | INIT_LIST_HEAD(&gr->tr_lst); |
2980 | 2979 | ||
@@ -3108,7 +3107,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, | |||
3108 | if (ret) | 3107 | if (ret) |
3109 | return ret; | 3108 | return ret; |
3110 | 3109 | ||
3111 | test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); | 3110 | test = kzalloc(sizeof(*test), GFP_KERNEL); |
3112 | if (!test) | 3111 | if (!test) |
3113 | return -ENOMEM; | 3112 | return -ENOMEM; |
3114 | 3113 | ||
@@ -3213,7 +3212,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card, | |||
3213 | return -ENODEV; | 3212 | return -ENODEV; |
3214 | } | 3213 | } |
3215 | 3214 | ||
3216 | df = kmalloc(sizeof(struct mmc_test_dbgfs_file), GFP_KERNEL); | 3215 | df = kmalloc(sizeof(*df), GFP_KERNEL); |
3217 | if (!df) { | 3216 | if (!df) { |
3218 | debugfs_remove(file); | 3217 | debugfs_remove(file); |
3219 | dev_err(&card->dev, | 3218 | dev_err(&card->dev, |