aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8149764f8438..7ceca0e8645a 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -774,12 +774,18 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
774 if (IS_ERR_OR_NULL(clk)) 774 if (IS_ERR_OR_NULL(clk))
775 return NULL; 775 return NULL;
776 776
777 /* save parent rate, if it exists */
778 if (clk->parent)
779 best_parent_rate = clk->parent->rate;
780
777 /* never propagate up to the parent */ 781 /* never propagate up to the parent */
778 if (!(clk->flags & CLK_SET_RATE_PARENT)) { 782 if (!(clk->flags & CLK_SET_RATE_PARENT)) {
779 if (!clk->ops->round_rate) { 783 if (!clk->ops->round_rate) {
780 clk->new_rate = clk->rate; 784 clk->new_rate = clk->rate;
781 return NULL; 785 return NULL;
782 } 786 }
787 new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate);
788 goto out;
783 } 789 }
784 790
785 /* need clk->parent from here on out */ 791 /* need clk->parent from here on out */
@@ -795,7 +801,6 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
795 goto out; 801 goto out;
796 } 802 }
797 803
798 best_parent_rate = clk->parent->rate;
799 new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate); 804 new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate);
800 805
801 if (best_parent_rate != clk->parent->rate) { 806 if (best_parent_rate != clk->parent->rate) {