amd64_edac: Fix single-channel setups
[firefly-linux-kernel-4.4.55.git] / drivers / edac / amd64_edac.c
index 8b6a0343c2208121cf858c6a22aea1816f427f16..8b3d90143514d79eee35dafec8d726174b30fd38 100644 (file)
@@ -2470,8 +2470,15 @@ static int amd64_init_one_instance(struct pci_dev *F2)
        layers[0].size = pvt->csels[0].b_cnt;
        layers[0].is_virt_csrow = true;
        layers[1].type = EDAC_MC_LAYER_CHANNEL;
-       layers[1].size = pvt->channel_count;
+
+       /*
+        * Always allocate two channels since we can have setups with DIMMs on
+        * only one channel. Also, this simplifies handling later for the price
+        * of a couple of KBs tops.
+        */
+       layers[1].size = 2;
        layers[1].is_virt_csrow = false;
+
        mci = edac_mc_alloc(nid, ARRAY_SIZE(layers), layers, 0);
        if (!mci)
                goto err_siblings;