In HEAD when doing no further checkes there is no reason use the

temporary variable and check with if as TUNABLE_*_FETCH do not
alter values unless successfully found the tunable.

Reported by:	jhb, bde
MFC after:	3 days
X-MFC with:	r224516
Approved by:	re (kib)
This commit is contained in:
Bjoern A. Zeeb 2011-08-20 19:21:46 +00:00
parent 6f69742441
commit 61bc18a327
3 changed files with 6 additions and 9 deletions

View File

@ -1309,7 +1309,7 @@ getmemsize(caddr_t kmdp, u_int64_t first)
{
int i, physmap_idx, pa_indx, da_indx;
vm_paddr_t pa, physmap[PHYSMAP_SIZE];
u_long physmem_tunable, memtest, tmpul;
u_long physmem_tunable, memtest;
pt_entry_t *pte;
struct bios_smap *smapbase, *smap, *smapend;
u_int32_t smapsize;
@ -1376,8 +1376,7 @@ getmemsize(caddr_t kmdp, u_int64_t first)
* one could eventually do more with the code than just disable it.
*/
memtest = 1;
if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
memtest = tmpul;
TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest);
/*
* Don't allow MAXMEM or hw.physmem to extend the amount of memory

View File

@ -2132,7 +2132,7 @@ static void
getmemsize(int first)
{
int has_smap, off, physmap_idx, pa_indx, da_indx;
u_long physmem_tunable, memtest, tmpul;
u_long physmem_tunable, memtest;
vm_paddr_t physmap[PHYSMAP_SIZE];
pt_entry_t *pte;
quad_t dcons_addr, dcons_size;
@ -2344,8 +2344,7 @@ getmemsize(int first)
* one could eventually do more with the code than just disable it.
*/
memtest = 1;
if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
memtest = tmpul;
TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest);
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
(boothowto & RB_VERBOSE))

View File

@ -1855,7 +1855,7 @@ static void
getmemsize(int first)
{
int off, physmap_idx, pa_indx, da_indx;
u_long physmem_tunable, memtest, tmpul;
u_long physmem_tunable, memtest;
vm_paddr_t physmap[PHYSMAP_SIZE];
pt_entry_t *pte;
quad_t dcons_addr, dcons_size;
@ -1920,8 +1920,7 @@ getmemsize(int first)
* one could eventually do more with the code than just disable it.
*/
memtest = 1;
if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
memtest = tmpul;
TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest);
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
(boothowto & RB_VERBOSE))