提交 80ca9a70 编写于 作者: M Milton Miller 提交者: Jaroslav Kysela

ALSA: correct kcalloc usage

kcalloc is supposed to be called with the count as its first argument and the
element size as the second.

Both arguments are size_t so does not affect correctness.  This callsite is
during module_init and therefore not performance critical.  Another patch will
optimize the case when the count is variable but the size is fixed.
Signed-off-by: NMilton Miller <miltonm@bga.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NJaroslav Kysela <perex@perex.cz>
上级 862c2c0a
...@@ -1302,8 +1302,8 @@ snd_nm256_mixer(struct nm256 *chip) ...@@ -1302,8 +1302,8 @@ snd_nm256_mixer(struct nm256 *chip)
.read = snd_nm256_ac97_read, .read = snd_nm256_ac97_read,
}; };
chip->ac97_regs = kcalloc(sizeof(short), chip->ac97_regs = kcalloc(ARRAY_SIZE(nm256_ac97_init_val),
ARRAY_SIZE(nm256_ac97_init_val), GFP_KERNEL); sizeof(short), GFP_KERNEL);
if (! chip->ac97_regs) if (! chip->ac97_regs)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册