Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1632705
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [alsa-devel] [PATCH 1/3] ASoC: simple-card: Use devm_kcalloc() in asoc_simple_card_parse_aux_devs() |
| Date | 2017-04-28 11:00 +0200 |
| Message-ID | <tB9UT-53z-45@gated-at.bofh.it> (permalink) |
| References | <tAuRI-2H8-3@gated-at.bofh.it> <tAuRI-2H8-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi, On 26/04/2017 at 15:04:11 +0200, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 26 Apr 2017 14:21:51 +0200 > > A multiplication for the size determination of a memory allocation > indicated that an array data structure should be processed. > Thus use the corresponding function "devm_kcalloc". > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > sound/soc/generic/simple-card.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c > index 2c9dedab5184..b59d51374b89 100644 > --- a/sound/soc/generic/simple-card.c > +++ b/sound/soc/generic/simple-card.c > @@ -334,8 +334,8 @@ static int asoc_simple_card_parse_aux_devs(struct device_node *node, > if (n <= 0) > return -EINVAL; > > - card->aux_dev = devm_kzalloc(dev, > - n * sizeof(*card->aux_dev), GFP_KERNEL); > + card->aux_dev = devm_kcalloc(dev, n, sizeof(*card->aux_dev), > + GFP_KERNEL); Do you realize that this change has absolutely no value and just makes the code slower (one more test in the allocation path)? -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] ASoC: simple-card: Fine-tuning for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-26 15:10 +0200
[PATCH 2/3] ASoC: simple-card: Use devm_kcalloc() in asoc_simple_card_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-26 15:10 +0200
[PATCH 1/3] ASoC: simple-card: Use devm_kcalloc() in asoc_simple_card_parse_aux_devs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-26 15:10 +0200
Re: [alsa-devel] [PATCH 1/3] ASoC: simple-card: Use devm_kcalloc() in asoc_simple_card_parse_aux_devs() Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-04-28 11:00 +0200
Re: [alsa-devel] [PATCH 1/3] ASoC: simple-card: Use devm_kcalloc() in asoc_simple_card_parse_aux_devs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-28 12:50 +0200
[PATCH 3/3] ASoC: simple-scu-card: Use devm_kcalloc() in asoc_simple_card_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-26 15:10 +0200
csiph-web