clk: tegra: emc: Avoid out-of-bounds bug

Apparently there was an attempt to avoid out-of-bounds accesses when there
is only one memory timing available, but there is a typo in the code that
neglects that attempt.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
Dmitry Osipenko 2018-06-05 15:12:32 +03:00 committed by Stephen Boyd
parent ce397d215c
commit 405fcacbd8

View File

@ -132,7 +132,7 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
timing = tegra->timings + i;
if (timing->rate > req->max_rate) {
i = min(i, 1);
i = max(i, 1);
req->rate = tegra->timings[i - 1].rate;
return 0;
}