diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2016-10-12 01:04:28 +0200 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-10-19 17:00:00 +0200 |
commit | 75f9131453c0e046f69ab4a8db7a3af7efcf6038 (patch) | |
tree | 70e096306e70c06195082656371d36d93d1ea00b /src/northbridge/intel/i945 | |
parent | 063cd5f6eee0ad9416e62eac4a168591220f53d0 (diff) | |
download | coreboot-75f9131453c0e046f69ab4a8db7a3af7efcf6038.tar.xz |
nb/i945,gm45,x4x/gma.c: fix unsigned arithmetics
This issue was found by Coverity Scan, CID 1364118.
Change-Id: Iba3c0f4f952729d9e0987d928b63ef8b8fe8841e
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/16992
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/northbridge/intel/i945')
-rw-r--r-- | src/northbridge/intel/i945/gma.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/northbridge/intel/i945/gma.c b/src/northbridge/intel/i945/gma.c index e40b9f00a8..d8950e61b7 100644 --- a/src/northbridge/intel/i945/gma.c +++ b/src/northbridge/intel/i945/gma.c @@ -177,7 +177,8 @@ static int intel_gma_init_lvds(struct northbridge_intel_i945_config *conf, u32 p = candp1 * pixel_p2; u32 vco = DIV_ROUND_CLOSEST(BASE_FREQUENCY * m, candn + 2); u32 dot = DIV_ROUND_CLOSEST(vco, p); - u32 this_err = ABS(dot - target_frequency); + u32 this_err = MAX(dot, target_frequency) - + MIN(dot, target_frequency); if ((m < 70) || (m > 120)) continue; if (this_err < smallest_err) { |