mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
imx clk: Skip reconfiguring the clock if we don't have a new best_parent
imx_clk_composite_find_best_parent can fail, when it does for all the clocks checked we attempt to configure an uninitialized best_parent leading to a panic. Initialize best_parent and skip reconfiguring the clock if we don't find a new best_parent to use. Reviewed By: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46662
This commit is contained in:
parent
80eb861dc2
commit
855c3dacfc
1 changed files with 5 additions and 0 deletions
|
|
@ -217,6 +217,7 @@ imx_clk_composite_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout
|
|||
p_names = clknode_get_parent_names(clk);
|
||||
|
||||
best_diff = 0;
|
||||
best_parent = -1;
|
||||
|
||||
for (p_idx = 0; p_idx != clknode_get_parents_num(clk); p_idx++) {
|
||||
p_clk = clknode_find_by_name(p_names[p_idx]);
|
||||
|
|
@ -243,6 +244,10 @@ imx_clk_composite_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout
|
|||
if (best_diff == INT64_MAX)
|
||||
return (ERANGE);
|
||||
|
||||
/* If we didn't find a new best_parent just return */
|
||||
if (best_parent == -1)
|
||||
return (0);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0) {
|
||||
*fout = best;
|
||||
return (0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue