Hi,

I have seen a warning that "while (abs(vco_fid - vco_cfid) > 2)"
is operating on unsigned values.  As our kernel's abs() takes a
signed integer as parameter, I think this codes works anyway.  The
unsigned is converted to signed before it is passed to abs().

Using singned values seems better nevertheless.  The variables fid
and cfid are signed, so the FID_TO_VCO_FID() macro creates signed
results.  When creating absolute differences we should keep the sign.

ok?

bluhm

Index: arch/amd64/amd64/powernow-k8.c
===================================================================
RCS file: /mount/openbsd/cvs/src/sys/arch/amd64/amd64/powernow-k8.c,v
retrieving revision 1.27
diff -u -p -r1.27 powernow-k8.c
--- arch/amd64/amd64/powernow-k8.c      9 Dec 2017 16:39:54 -0000       1.27
+++ arch/amd64/amd64/powernow-k8.c      13 Jan 2018 22:25:35 -0000
@@ -231,7 +231,7 @@ k8pnow_transition(struct k8pnow_cpu_stat
 
        /* Phase 2: change to requested core frequency */
        if (cfid != fid) {
-               u_int vco_fid, vco_cfid;
+               int vco_fid, vco_cfid;
 
                vco_fid = FID_TO_VCO_FID(fid);
                vco_cfid = FID_TO_VCO_FID(cfid);

Reply via email to