]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
edac: i7300_edac: Fix 'may be used uninitialized' warning
authorBen Hutchings <ben@decadent.org.uk>
Mon, 6 Nov 2017 01:09:48 +0000 (01:09 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 11 Nov 2017 13:34:43 +0000 (13:34 +0000)
gcc 4.7 warns that nr_pages may be used uninitialized in
i7300_init_csrows().  In fact, the case where it's not initialised is
an error that will result in returning early without using it.
Silence the warning by initialising to 0.

This was done upstream as part of commit 084a4fccef39 "edac: move dimm
properties to struct dimm_info".

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/edac/i7300_edac.c

index 1e084260c9c04701f2544567f748a2b7bc90e2a2..9afb59890c6532066f7b22d322edc0b32f9d72a3 100644 (file)
@@ -803,6 +803,7 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)
        }
 
        /* Get the set of MTR[0-7] regs by each branch */
+       nr_pages = 0;
        for (slot = 0; slot < MAX_SLOTS; slot++) {
                int where = mtr_regs[slot];
                for (branch = 0; branch < MAX_BRANCHES; branch++) {