EDAC: Fix mc size reported in sysfs
authorJosh Hunt <johunt@akamai.com>
Fri, 21 Sep 2012 14:45:49 +0000 (07:45 -0700)
committerBorislav Petkov <bp@alien8.de>
Wed, 28 Nov 2012 10:54:50 +0000 (11:54 +0100)
This is the complement to previous commit "EDAC: Fix csrow size
reported in sysfs". This fixes the memory controller size reporting on
csrow-based memory controllers. The csrow size is already combined for
both channels. Without this patch memory size is reported doubled.

Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
drivers/edac/edac_mc_sysfs.c

index bd46610979c756e8d674c1ba110f2f69c9c9593e..a242dae1aeb0ef2bc7d1131fdc8f0190dffd7a9c 100644 (file)
@@ -781,10 +781,14 @@ static ssize_t mci_size_mb_show(struct device *dev,
        for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) {
                struct csrow_info *csrow = mci->csrows[csrow_idx];
 
-               for (j = 0; j < csrow->nr_channels; j++) {
-                       struct dimm_info *dimm = csrow->channels[j]->dimm;
-
-                       total_pages += dimm->nr_pages;
+               if (csrow->mci->csbased) {
+                       total_pages += csrow->nr_pages;
+               } else {
+                       for (j = 0; j < csrow->nr_channels; j++) {
+                               struct dimm_info *dimm = csrow->channels[j]->dimm;
+
+                               total_pages += dimm->nr_pages;
+                       }
                }
        }