Skip to contentSkip to conversation

regmap: Fix kcalloc parameters swapped

PATCH Applied Axel Lin 2 participants 2 messages Feb 10, 2012

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regmap: Fix kcalloc parameters swapped

The first parameter should be "number of elements" and the second parameter should be "element size".

---
 drivers/base/regmap/regmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/regmap/regmap.c +1 -1
index f9cdaf3..11d54e7 100644
@@ -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
Applied
#1 lore raw
Quoted 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...