Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1555043
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions |
| Date | 2017-01-10 09:40 +0100 |
| Message-ID | <sY08i-7ry-29@gated-at.bofh.it> (permalink) |
| References | <sXtvH-3AV-7@gated-at.bofh.it> <sXtFo-3Eh-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2017/1/9 5:49, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:25:44 +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.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index bb9f569a5dd5..294d3c675734 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,
> if (max_segs > max_page_cnt)
> max_segs = max_page_cnt;
>
> - mem = kzalloc(sizeof(struct mmc_test_mem), GFP_KERNEL);
> + mem = kzalloc(sizeof(*mem), GFP_KERNEL);
> if (!mem)
> return NULL;
>
> @@ -545,7 +545,7 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test,
> if (!test->gr)
> return;
>
> - tr = kmalloc(sizeof(struct mmc_test_transfer_result), GFP_KERNEL);
> + tr = kmalloc(sizeof(*tr), GFP_KERNEL);
> if (!tr)
> return;
>
> @@ -2973,8 +2973,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> }
> }
>
> - gr = kzalloc(sizeof(struct mmc_test_general_result),
> - GFP_KERNEL);
> + gr = kzalloc(sizeof(*gr), GFP_KERNEL);
> if (gr) {
> INIT_LIST_HEAD(&gr->tr_lst);
>
> @@ -3108,7 +3107,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
> if (ret)
> return ret;
>
> - test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
> + test = kzalloc(sizeof(*test), GFP_KERNEL);
> if (!test)
> return -ENOMEM;
>
> @@ -3213,7 +3212,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
> return -ENODEV;
> }
>
> - df = kmalloc(sizeof(struct mmc_test_dbgfs_file), GFP_KERNEL);
> + df = kmalloc(sizeof(*df), GFP_KERNEL);
> if (!df) {
> debugfs_remove(file);
> dev_err(&card->dev,
>
--
Best Regards
Shawn Lin
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] MMC-core: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
[PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:40 +0100
[PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:40 +0100
[PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Chunyan Zhang <zhang.chunyan@linaro.org> - 2017-01-10 08:40 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:50 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-11 03:00 +0100
[PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 23:00 +0100
Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem() Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem() Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:30 +0100
[PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 23:00 +0100
Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:40 +0100
[PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 23:20 +0100
Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:30 +0100
Re: [PATCH 0/8] MMC-core: Fine-tuning for some function implementations Ulf Hansson <ulf.hansson@linaro.org> - 2017-01-12 13:10 +0100
csiph-web