Skip to contentSkip to conversation

regmap: fix compilation warning

PATCH In review Mike Rapoport 2 participants 2 messages Sep 2, 2015 – Sep 14, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: fix compilation warning

Explicitly initialize ret to -EINVAL in regmap_raw_read to fix the following compilation warning:

CC drivers/base/regmap/regmap.o
linux/drivers/base/regmap/regmap.c: In function ‘regmap_raw_read’:
linux/drivers/base/regmap/regmap.c:2174:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]

  int ret, i;
      ^
---
 drivers/base/regmap/regmap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap.c +5 -4
index 7111d04..ba0aab4 100644
@@ -2171,14 +2171,15 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 	size_t val_bytes = map->format.val_bytes;
 	size_t val_count = val_len / val_bytes;
 	unsigned int v;
-	int ret, i;
+	int i;
+	int ret = -EINVAL;
 
 	if (!map->bus)
-		return -EINVAL;
+		return ret;
 	if (val_len % map->format.val_bytes)
-		return -EINVAL;
+		return ret;
 	if (reg % map->reg_stride)
-		return -EINVAL;
+		return ret;
 
 	map->lock(map->lock_arg);
 
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 2 lines · Mike Rapoport

Explicitly initialize ret to -EINVAL in regmap_raw_read to fix the following compilation warning:

This doesn't seem to apply any more, can you please check and resend if it's still needed (there were some changes went in near the merge window it collided with).