Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e474142b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: clock: Check that round_rate is less than fmax"

parents 32a0b8ef 72529cff
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -544,13 +544,26 @@ EXPORT_SYMBOL(clk_set_rate);

long clk_round_rate(struct clk *clk, unsigned long rate)
{
	long rrate;
	unsigned long fmax = 0, i;

	if (IS_ERR_OR_NULL(clk))
		return -EINVAL;

	if (!clk->ops->round_rate)
		return -ENOSYS;

	return clk->ops->round_rate(clk, rate);
	for (i = 0; i < clk->num_fmax; i++)
		fmax = max(fmax, clk->fmax[i]);

	if (!fmax)
		fmax = ULONG_MAX;

	rate = min(rate, fmax);
	rrate = clk->ops->round_rate(clk, rate);
	if (rrate > fmax)
		return -EINVAL;
	return rrate;
}
EXPORT_SYMBOL(clk_round_rate);