|
@@ -200,11 +200,11 @@ static struct clk_hw *cp110_of_clk_get(struct of_phandle_args *clkspec,
|
|
|
unsigned int idx = clkspec->args[1];
|
|
|
|
|
|
if (type == CP110_CLK_TYPE_CORE) {
|
|
|
- if (idx > CP110_MAX_CORE_CLOCKS)
|
|
|
+ if (idx >= CP110_MAX_CORE_CLOCKS)
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
return clk_data->hws[idx];
|
|
|
} else if (type == CP110_CLK_TYPE_GATABLE) {
|
|
|
- if (idx > CP110_MAX_GATABLE_CLOCKS)
|
|
|
+ if (idx >= CP110_MAX_GATABLE_CLOCKS)
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
return clk_data->hws[CP110_MAX_CORE_CLOCKS + idx];
|
|
|
}
|