[PATCH 1/3] regcache: flat: Use cache element type in sizeof

From: Andrew F. Davis
Date: Sun Jan 07 2018 - 18:22:52 EST


A single cache element may not always be unsigned int, use a
cache element in sizeof over hard-coding its type.

Signed-off-by: Andrew F. Davis <afd@xxxxxx>
---
drivers/base/regmap/regcache-flat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regcache-flat.c b/drivers/base/regmap/regcache-flat.c
index 4d2e50bfc726..2ea5fc84a374 100644
--- a/drivers/base/regmap/regcache-flat.c
+++ b/drivers/base/regmap/regcache-flat.c
@@ -31,7 +31,7 @@ static int regcache_flat_init(struct regmap *map)
return -EINVAL;

map->cache = kcalloc(regcache_flat_get_index(map, map->max_register)
- + 1, sizeof(unsigned int), GFP_KERNEL);
+ + 1, sizeof(*cache), GFP_KERNEL);
if (!map->cache)
return -ENOMEM;

--
2.15.1