public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regmap: maple: work around gcc-14.1 false-positive warning
@ 2024-07-19 10:40 Arnd Bergmann
  2024-07-22 18:41 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-07-19 10:40 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman
  Cc: Arnd Bergmann, Rafael J. Wysocki, Richard Fitzgerald,
	Guenter Roeck, Colin Ian King, Andy Shevchenko, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
I'm still not convinced that this is the best solution, but I had no
other ideas here.
---
 drivers/base/regmap/regcache-maple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c
index f0df2da6d522..2dea9d259c49 100644
--- a/drivers/base/regmap/regcache-maple.c
+++ b/drivers/base/regmap/regcache-maple.c
@@ -110,7 +110,8 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
 	struct maple_tree *mt = map->cache;
 	MA_STATE(mas, mt, min, max);
 	unsigned long *entry, *lower, *upper;
-	unsigned long lower_index, lower_last;
+	/* initialized to work around false-positive -Wuninitialized warning */
+	unsigned long lower_index = 0, lower_last = 0;
 	unsigned long upper_index, upper_last;
 	int ret = 0;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regmap: maple: work around gcc-14.1 false-positive warning
  2024-07-19 10:40 [PATCH] regmap: maple: work around gcc-14.1 false-positive warning Arnd Bergmann
@ 2024-07-22 18:41 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2024-07-22 18:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arnd Bergmann
  Cc: Arnd Bergmann, Rafael J. Wysocki, Richard Fitzgerald,
	Guenter Roeck, Colin Ian King, Andy Shevchenko, linux-kernel

On Fri, 19 Jul 2024 12:40:24 +0200, Arnd Bergmann wrote:
> 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;
>       |                                    ^~~~~~~~~~
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: maple: work around gcc-14.1 false-positive warning
      commit: 542440fd7b30983cae23e32bd22f69a076ec7ef4

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-22 18:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19 10:40 [PATCH] regmap: maple: work around gcc-14.1 false-positive warning Arnd Bergmann
2024-07-22 18:41 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox