Skip to content

Commit b705992

Browse files
linuswbroonie
authored andcommitted
regmap: check right noinc bounds in debug print
We were using the wrong bound in the debug prints: this needs to be the number of elements, not the number of bytes, since we're indexing into an element-size typed array. Fixes: c20cc09 ("regmap: Support accelerated noinc operations") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 026c99b commit b705992

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/base/regmap/regmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,7 +2193,7 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg,
21932193

21942194
if (!ret && regmap_should_log(map)) {
21952195
dev_info(map->dev, "%x %s [", reg, write ? "<=" : "=>");
2196-
for (i = 0; i < val_len; i++) {
2196+
for (i = 0; i < val_count; i++) {
21972197
switch (val_bytes) {
21982198
case 1:
21992199
pr_cont("%x", u8p[i]);
@@ -2212,7 +2212,7 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg,
22122212
default:
22132213
break;
22142214
}
2215-
if (i == (val_len - 1))
2215+
if (i == (val_count - 1))
22162216
pr_cont("]\n");
22172217
else
22182218
pr_cont(",");

0 commit comments

Comments
 (0)