public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avr32: favr-32: clk_round_rate() can return a zero upon error
@ 2013-12-10  2:35 Paul Walmsley
  2013-12-10  7:39 ` Hans-Christian Egtvedt
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Walmsley @ 2013-12-10  2:35 UTC (permalink / raw)
  To: Nicolas Ferre, Håvard Skinnemoen, Hans-Christian Egtvedt,
	Jean-Christophe PLAGNIOL-VILLARD
  Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]


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.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Håvard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
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(-)

diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 7b1f2cd85400..1f121497b517 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -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)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-10  7:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10  2:35 [PATCH] avr32: favr-32: clk_round_rate() can return a zero upon error Paul Walmsley
2013-12-10  7:39 ` Hans-Christian Egtvedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox