regmap: Fix kcalloc parameters swapped
Subsystems (2)
PATCH 1/1 regmap: Fix kcalloc parameters swapped
The first parameter should be "number of elements" and the second parameter should be "element size".
Signed-off-by Axel Lin <[email protected]>
--- drivers/base/regmap/regmap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/regmap/regmap.c +1 -1
@@ -785,7 +785,7 @@ int regmap_register_patch(struct regmap *map, const struct reg_default *regs, } } - map->patch =kcalloc (sizeof (struct reg_default ), num_regs,GFP_KERNEL ); + map->patch =kcalloc (num_regs,sizeof (struct reg_default ),GFP_KERNEL );if (map->patch !=NULL ) {memcpy (map->patch, regs, num_regs *sizeof (struct reg_default ));
Signature · 1 line
1.7.5.4
Mark Brown
AppliedQuoted 2 lines · Axel Lin
The first parameter should be "number of elements" and the second parameter should be "element size".
Applied, thanks. Not that it makes any practical difference given that the function will just multiply the two numbers...