• Dmitry Antipov's avatar
    regmap: fix kcalloc() arguments order · 3b201c9a
    Dmitry Antipov authored
    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.ruSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    3b201c9a
regmap-raw-ram.c 3.16 KB