Merge tag 'u-boot-atmel-fixes-2021.01-b' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / arch / x86 / cpu / mtrr.c
index 5180eb0..6f095c5 100644 (file)
@@ -158,7 +158,7 @@ int mtrr_commit(bool do_caches)
 
        /* Clear the ones that are unused */
        debug("clear\n");
-       for (; i < MTRR_MAX_COUNT; i++)
+       for (; i < mtrr_get_var_count(); i++)
                wrmsrl(MTRR_PHYS_MASK_MSR(i), 0);
        debug("close\n");
        mtrr_close(&state, do_caches);