Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1308847 > unrolled thread

[PATCH] regmap: pass buffer size to regmap_raw_read() in regcache_hw_init()

Started by"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
First post2016-01-13 22:50 +0100
Last post2016-01-13 22:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] regmap: pass buffer size to regmap_raw_read() in regcache_hw_init() "Maciej S. Szmigiero" <mail@maciej.szmigiero.name> - 2016-01-13 22:50 +0100

#1308847 — [PATCH] regmap: pass buffer size to regmap_raw_read() in regcache_hw_init()

From"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Date2016-01-13 22:50 +0100
Subject[PATCH] regmap: pass buffer size to regmap_raw_read() in regcache_hw_init()
Message-ID<qQBsK-5De-13@gated-at.bofh.it>
regcache_hw_init() uses regmap_raw_read() to initialize cache
when reg_defaults_raw isn't provided.

The last parameter to regmap_raw_read() is buffer size in bytes,
however regcache_hw_init() called it with number of registers
to read instead, which cause problem if they aren't one byte
wide in cache.

This wasn't triggered by any of current in-tree drivers
since they either have one-byte registers or provide
reg_defaults_raw explicitly.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---
 drivers/base/regmap/regcache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Use this opportunity to also add missing space at the end of comment
a few lines above.

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 4c07802986b2..45ae91eb6be9 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -57,7 +57,7 @@ static int regcache_hw_init(struct regmap *map)
 		bool cache_bypass = map->cache_bypass;
 		dev_warn(map->dev, "No cache defaults, reading back from HW\n");
 
-		/* Bypass the cache access till data read from HW*/
+		/* Bypass the cache access till data read from HW */
 		map->cache_bypass = true;
 		tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL);
 		if (!tmp_buf) {
@@ -65,7 +65,7 @@ static int regcache_hw_init(struct regmap *map)
 			goto err_free;
 		}
 		ret = regmap_raw_read(map, 0, tmp_buf,
-				      map->num_reg_defaults_raw);
+				      map->cache_size_raw);
 		map->cache_bypass = cache_bypass;
 		if (ret < 0)
 			goto err_cache_free;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web