Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.3
xen
5fedf9f4-x86-hpet_setup-fix-retval.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5fedf9f4-x86-hpet_setup-fix-retval.patch of Package xen
# Commit 83736c567d6b64dbce98f251ca72e7870f556421 # Date 2020-12-31 16:19:00 +0000 # Author Andrew Cooper <andrew.cooper3@citrix.com> # Committer Andrew Cooper <andrew.cooper3@citrix.com> x86/hpet: Fix return value of hpet_setup() hpet_setup() is idempotent if the rate has already been calculated, and returns the cached value. However, this only works correctly when the return statements are identical. Use a sensibly named local variable, rather than a dead one with a bad name. Fixes: a60bb68219 ("x86/time: reduce rounding errors in calculations") Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -769,7 +769,7 @@ u64 __init hpet_setup(void) { static u64 __initdata hpet_rate; u32 hpet_id, hpet_period; - unsigned int last; + unsigned int last, rem; if ( hpet_rate ) return hpet_rate; @@ -799,9 +799,11 @@ u64 __init hpet_setup(void) hpet_resume(hpet_boot_cfg); hpet_rate = 1000000000000000ULL; /* 10^15 */ - last = do_div(hpet_rate, hpet_period); + rem = do_div(hpet_rate, hpet_period); + if ( (rem * 2) > hpet_period ) + hpet_rate++; - return hpet_rate + (last * 2 > hpet_period); + return hpet_rate; } void hpet_resume(u32 *boot_cfg)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor