Unverified Commit 3b201c9a authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Mark Brown
Browse files

regmap: fix kcalloc() arguments order



When compiling with gcc version 14.0.0 20231220 (experimental)
and W=1, I've noticed a bunch of four similar warnings like:

drivers/base/regmap/regmap-ram.c: In function '__regmap_init_ram':
drivers/base/regmap/regmap-ram.c:68:37: warning: 'kcalloc' sizes specified with
'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
   68 |         data->read = kcalloc(sizeof(bool), config->max_register + 1,
      |                                     ^~~~

Since 'n' and 'size' arguments of 'kcalloc()' are multiplied to
calculate the final size, their actual order doesn't affect the
result and so this is not a bug. But it's still worth to fix it.

Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Link: https://msgid.link/r/20231220175829.533700-1-dmantipov@yandex.ru


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1957b92a
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment