Commit 405fcacb authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Stephen Boyd

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: default avatarDmitry Osipenko <digetx@gmail.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent ce397d21
...@@ -132,7 +132,7 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) ...@@ -132,7 +132,7 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
timing = tegra->timings + i; timing = tegra->timings + i;
if (timing->rate > req->max_rate) { if (timing->rate > req->max_rate) {
i = min(i, 1); i = max(i, 1);
req->rate = tegra->timings[i - 1].rate; req->rate = tegra->timings[i - 1].rate;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment