lkml.org 
[lkml]   [2022]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regmap: check right noinc bounds in debug print
Date
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: c20cc099b30a ("regmap: Support accelerated noinc operations")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/base/regmap/regmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 41ff9f18b6a3..f8815a8fedcb 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2193,7 +2193,7 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg,

if (!ret && regmap_should_log(map)) {
dev_info(map->dev, "%x %s [", reg, write ? "<=" : "=>");
- for (i = 0; i < val_len; i++) {
+ for (i = 0; i < val_count; i++) {
switch (val_bytes) {
case 1:
pr_cont("%x", u8p[i]);
@@ -2212,7 +2212,7 @@ static int regmap_noinc_readwrite(struct regmap *map, unsigned int reg,
default:
break;
}
- if (i == (val_len - 1))
+ if (i == (val_count - 1))
pr_cont("]\n");
else
pr_cont(",");
--
2.37.2
\
 
 \ /
  Last update: 2022-08-23 19:13    [W:0.032 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site