Skip to content

Commit e42ea96

Browse files
arndbgregkh
authored andcommitted
regmap: maple: work around gcc-14.1 false-positive warning
[ Upstream commit 542440f ] With gcc-14.1, there is a false-postive -Wuninitialized warning in regcache_maple_drop: drivers/base/regmap/regcache-maple.c: In function 'regcache_maple_drop': drivers/base/regmap/regcache-maple.c:113:23: error: 'lower_index' is used uninitialized [-Werror=uninitialized] 113 | unsigned long lower_index, lower_last; | ^~~~~~~~~~~ drivers/base/regmap/regcache-maple.c:113:36: error: 'lower_last' is used uninitialized [-Werror=uninitialized] 113 | unsigned long lower_index, lower_last; | ^~~~~~~~~~ I've created a reduced test case to see if this needs to be reported as a gcc, but it appears that the gcc-14.x branch already has a change that turns this into a more sensible -Wmaybe-uninitialized warning, so I ended up not reporting it so far. The reduced test case also produces a warning for gcc-13 and gcc-12 but I don't see that with the version in the kernel. Link: https://godbolt.org/z/oKbohKqd3 Link: https://lore.kernel.org/all/CAMuHMdWj=FLmkazPbYKPevDrcym2_HDb_U7Mb9YE9ovrP0jJfA@mail.gmail.com/ Signed-off-by: Arnd Bergmann <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent fd8e141 commit e42ea96

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/base/regmap/regcache-maple.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
110110
struct maple_tree *mt = map->cache;
111111
MA_STATE(mas, mt, min, max);
112112
unsigned long *entry, *lower, *upper;
113-
unsigned long lower_index, lower_last;
113+
/* initialized to work around false-positive -Wuninitialized warning */
114+
unsigned long lower_index = 0, lower_last = 0;
114115
unsigned long upper_index, upper_last;
115116
int ret = 0;
116117

0 commit comments

Comments
 (0)