Subject: Re: CVS commit: src/sys/kern
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Frank Kardel <kardel@netbsd.org>
List: source-changes
Date: 09/09/2006 14:01:01
Izumi Tsutsui wrote:

>simonb@NetBSD.org wrote:
>
>  
>
>>Module Name:	src
>>Committed By:	simonb
>>Date:		Thu Sep  7 15:48:14 UTC 2006
>>
>>Modified Files:
>>	src/sys/kern: kern_tc.c
>>
>>Log Message:
>>Guard the timecounter manipulations including the call to tc_windup()
>>in tc_init() with splclock().  Fixes doubled-up "selected timecounter"
>>messages on some architectures, including pc532 and cobalt.
>>
>>Fix suggested by Frank Kardel.
>>    
>>
>
>splclock()/splx() unmatch?
>
>Index: kern_tc.c
>===================================================================
>RCS file: /cvsroot/src/sys/kern/kern_tc.c,v
>retrieving revision 1.11
>diff -u -r1.11 kern_tc.c
>--- kern_tc.c	7 Sep 2006 15:48:14 -0000	1.11
>+++ kern_tc.c	9 Sep 2006 11:34:27 -0000
>@@ -455,17 +455,18 @@
> 	 * worse since this timecounter may not be monotonous.
> 	 */
> 	if (tc->tc_quality < 0)
>-		return;
>+		goto out;
> 	if (tc->tc_quality < timecounter->tc_quality)
>-		return;
>+		goto out;
> 	if (tc->tc_quality == timecounter->tc_quality &&
> 	    tc->tc_frequency < timecounter->tc_frequency)
>-		return;
>+		goto out;
> 	(void)tc->tc_get_timecount(tc);
> 	(void)tc->tc_get_timecount(tc);
> 	timecounter = tc;
> 	tc_windup();
> 
>+ out:
> 	splx(s);
> }
> 
>---
>Izumi Tsutsui
>  
>
Yes, the current commit is broken. I personally don't like gotos, but 
the if-condition
would look to nice either.

Frank