svn commit: r245899 - head/usr.sbin/bhyve

Neel Natu neel at FreeBSD.org
Fri Jan 25 06:27:04 UTC 2013


Author: neel
Date: Fri Jan 25 06:27:03 2013
New Revision: 245899
URL: http://svnweb.freebsd.org/changeset/base/245899

Log:
  Use the correct type (uint64_t) to retrieve sysctl machdep.tsc_freq.
  
  Simplify the function a bit by falling through after initialization and
  return via the normal code path.
  
  Reviewed by:	grehan
  Obtained from:	NetApp

Modified:
  head/usr.sbin/bhyve/pmtmr.c

Modified: head/usr.sbin/bhyve/pmtmr.c
==============================================================================
--- head/usr.sbin/bhyve/pmtmr.c	Fri Jan 25 06:18:49 2013	(r245898)
+++ head/usr.sbin/bhyve/pmtmr.c	Fri Jan 25 06:27:03 2013	(r245899)
@@ -66,17 +66,14 @@ pmtmr_val(void)
 
 	if (!inited) {
 		size_t len;
-		uint32_t tmpf;
 
 		inited = 1;
 		pthread_mutex_init(&pmtmr_mtx, NULL);
-		len = sizeof(tmpf);
-		sysctlbyname("machdep.tsc_freq", &tmpf, &len,
+		len = sizeof(pmtmr_tscf);
+		sysctlbyname("machdep.tsc_freq", &pmtmr_tscf, &len,
 		    NULL, 0);
-		pmtmr_tscf = tmpf;
 		pmtmr_tsc_old = rdtsc();
 		pmtmr_old = pmtmr_tsc_old / pmtmr_tscf * PMTMR_FREQ;
-		return (pmtmr_old);
 	}
 
 	pthread_mutex_lock(&pmtmr_mtx);


More information about the svn-src-head mailing list