diff options
-rw-r--r-- | src/vendorcode/cavium/bdk/libdram/lib_octeon_shared.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vendorcode/cavium/bdk/libdram/lib_octeon_shared.c b/src/vendorcode/cavium/bdk/libdram/lib_octeon_shared.c index 7ee91c27c3b7..cb090f7da5e5 100644 --- a/src/vendorcode/cavium/bdk/libdram/lib_octeon_shared.c +++ b/src/vendorcode/cavium/bdk/libdram/lib_octeon_shared.c @@ -1141,6 +1141,11 @@ int initialize_ddr_clock(bdk_node_t node, override_pll_settings = 1; } + if (best_en_idx >= ARRAY_SIZE(_en)) { + error_print("ERROR: best_en_idx %u exceeds _en array size\n", best_en_idx); + return -1; + } + if (override_pll_settings) { best_pll_MHz = ddr_ref_hertz * (best_clkf+1) / (best_clkr+1) / 1000000; best_calculated_ddr_hertz = ddr_ref_hertz * (best_clkf + 1) / ((best_clkr + 1) * (_en[best_en_idx])); |