avr32: favr-32: clk_round_rate() can return a zero upon error
PATCH 1/1 avr32: favr-32: clk_round_rate() can return a zero upon error
Treat both negative and zero return values from clk_round_rate() as errors. This is needed since subsequent patches will convert clk_round_rate()'s return value to be an unsigned type, rather than a signed type, since some clock sources can generate rates higher than (2^31)-1 Hz.
Eventually, when calling clk_round_rate(), only a return value of zero will be considered a error. All other values will be considered valid rates. The comparison against values less than 0 is kept to preserve the correct behavior in the meantime.
---
Applies on v3.13-rc3. See also:
http://marc.info/?l=linux-arm-kernel&m=138542591313620&w=2
arch/avr32/boards/favr-32/setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/avr32/boards/favr-32/setup.c +3 -1
@@ -298,8 +298,10 @@ static int __init set_abdac_rate(struct platform_device *pdev)*/ retval =clk_round_rate (pll1,CONFIG_BOARD_FAVR32_ABDAC_RATE *256 *16 ); -if (retval <0 ) +if (retval <=0 ) { + retval = -EINVAL ; goto out_abdac; + } retval =clk_set_rate (pll1, retval);if (retval !=0 )
Quoted 12 lines · Paul Walmsley
Treat both negative and zero return values from
clk_round_rate()as errors. This is needed since subsequent patches will convert clk_round_rate()'s return value to be an unsigned type, rather than a signed type, since some clock sources can generate rates higher than (2^31)-1 Hz.Eventually, when calling
clk_round_rate(), only a return value of zero will be considered a error. All other values will be considered valid rates. The comparison against values less than 0 is kept to preserve the correct behavior in the meantime.
Quoted 5 lines
Signed-off-by Paul Walmsley <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Håvard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Thanks for fixing, applied to for-linus branch ingit://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32.git
Quoted 24 lines
---
Applies on v3.13-rc3. See also:http://marc.info/?l=linux-arm-kernel&m=138542591313620&w=2
arch/avr32/boards/favr-32/setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/avr32/boards/favr-32/setup.c +3
-1@@ -298,8 +298,10 @@ static int __init set_abdac_rate(struct platform_device *pdev)*/ retval =clk_round_rate (pll1,CONFIG_BOARD_FAVR32_ABDAC_RATE *256 *16 ); -if (retval <0 ) +if (retval <=0 ) { + retval = -EINVAL ; goto out_abdac; + } retval =clk_set_rate (pll1, retval);if (retval !=0 )
Signature · 2 lines
mvh Hans-Christian Egtvedt