]> www.infradead.org Git - users/jedix/linux-maple.git/commit
EDAC/ie31200: work around false positive build warning
authorArnd Bergmann <arnd@arndb.de>
Wed, 22 Jan 2025 06:50:26 +0000 (07:50 +0100)
committerTony Luck <tony.luck@intel.com>
Fri, 21 Feb 2025 00:56:41 +0000 (16:56 -0800)
commitc29dfd661fe2f8d1b48c7f00590929c04b25bf40
tree9bd52f672b1d70b7ae8ed64c3a581857688bee6a
parent0ad2507d5d93f39619fc42372c347d6006b64319
EDAC/ie31200: work around false positive build warning

gcc-14 produces a bogus warning in some configurations:

drivers/edac/ie31200_edac.c: In function 'ie31200_probe1.isra':
drivers/edac/ie31200_edac.c:412:26: error: 'dimm_info' is used uninitialized [-Werror=uninitialized]
  412 |         struct dimm_data dimm_info[IE31200_CHANNELS][IE31200_DIMMS_PER_CHANNEL];
      |                          ^~~~~~~~~
drivers/edac/ie31200_edac.c:412:26: note: 'dimm_info' declared here
  412 |         struct dimm_data dimm_info[IE31200_CHANNELS][IE31200_DIMMS_PER_CHANNEL];
      |                          ^~~~~~~~~

I don't see any way the unintialized access could really happen here,
but I can see why the compiler gets confused by the two loops.

Instead, rework the two nested loops to only read the addr_decode
registers and then keep only one instance of the dimm info structure.

[Tony: Qiuxu pointed out that the "populate DIMM info" comment was left
behind in the refactor and suggested moving it. I deleted the comment
as unnecessry in front os a call to populate_dimm_info(). That seems
pretty self-describing.]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Baron <jbaron@akamai.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/all/20250122065031.1321015-1-arnd@kernel.org
drivers/edac/ie31200_edac.c