]> git.baikalelectronics.ru Git - kernel.git/commit
clk: check ->determine/round_rate() return value in clk_calc_new_rates
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Sun, 29 Mar 2015 01:48:48 +0000 (03:48 +0200)
committerMichael Turquette <mturquette@linaro.org>
Mon, 13 Apr 2015 04:09:49 +0000 (21:09 -0700)
commit9d76bc5f85c39c6a879bdd831a7ed5f76a2c6eeb
treec4d41d3a87567ebbe374db36b156621a7e6f6d55
parent94241d6e2fb04e22c0efa613115a4392c77d7de8
clk: check ->determine/round_rate() return value in clk_calc_new_rates

->determine_rate() and ->round_rate() can return the closest rate to the
requested one or an error code.
clk_calc_new_rates is assuming these functions can't return a negative
value, which leads to a undefined behavior when the clk implementation
returns such an error code.
Fix this by returning NULL in case ->determine_rate() or ->round_rate()
returned an error code.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
drivers/clk/clk.c