regmap: fix kcalloc() arguments order
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 20 Dec 2023 17:58:19 +0000 (20:58 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 20 Dec 2023 18:11:38 +0000 (18:11 +0000)
commit3b201c9af7c0cad2e8311d96c0c1b399606c70fa
tree4026d61edca0d0565f9fa79e698ac36717d95e22
parent1957b92aaff0fa71621e61bbd0257b9c3bb9baf2
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: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://msgid.link/r/20231220175829.533700-1-dmantipov@yandex.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap-ram.c
drivers/base/regmap/regmap-raw-ram.c