[PATCH RFC] EDAC: octeon: Fix uninitialized variable warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: James Hogan <jhogan@xxxxxxxxxx>

Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
2016.05-03:

drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (int_reg.s.sec_err || int_reg.s.ded_err) {
                        ^

This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
injection support"), and is fixed by initialising the whole int_reg
variable to zero before the conditional assignments in the error
injection case.

Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
Signed-off-by: James Hogan <jhogan@xxxxxxxxxx>
Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Cc: David Daney <david.daney@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
Cc: Daniel Walker <dwalker@xxxxxxxxxx>
Cc: Steven J. Hill <steven.hill@xxxxxxxxxx>
Cc: linux-edac@xxxxxxxxxxxxxxx
Cc: linux-mips@xxxxxxxxxxxxxx
Cc: <stable@xxxxxxxxxxxxxxx> # 3.15+
---
Comments appreciated. Is this correct?

I've added the stable tag on the assumption that this might matter. If
not it can be changed. It'd be nice to have it in 4.14 though to silence
the warning since the driver was added to cavium_octeon_defconfig in
commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
drivers").
---
 drivers/edac/octeon_edac-lmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c
index 9c1ffe3e912b..aeb222ca3ed1 100644
--- a/drivers/edac/octeon_edac-lmc.c
+++ b/drivers/edac/octeon_edac-lmc.c
@@ -78,6 +78,7 @@ static void octeon_lmc_edac_poll_o2(struct mem_ctl_info *mci)
 	if (!pvt->inject)
 		int_reg.u64 = cvmx_read_csr(CVMX_LMCX_INT(mci->mc_idx));
 	else {
+		int_reg.u64 = 0;
 		if (pvt->error_type == 1)
 			int_reg.s.sec_err = 1;
 		if (pvt->error_type == 2)
-- 
2.14.1




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]