On Tue, 2019-02-19 at 11:05 -0800, Nick Desaulniers wrote: > On Tue, Feb 19, 2019 at 10:21 AM Nathan Chancellor > <natechancellor@xxxxxxxxx> wrote: > > Clang warns: > > > > drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: > > warning: > > comparison of distinct pointer types ('typeof ((rtt_avg)) *' (aka > > 'long > > long *') and 'uint64_t *' (aka 'unsigned long long *')) > > [-Wcompare-distinct-pointer-types] > > do_div(rtt_avg, 6666); > > ^~~~~~~~~~~~~~~~~~~~~ > > include/asm-generic/div64.h:222:28: note: expanded from macro > > 'do_div' > > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ > > ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ > > 1 warning generated. > > > > do_div expects an unsigned dividend. Use div64_s64, which expects a > > signed dividend. > > Eh, IIRC, signed vs unsigned division has implications for rounding > towards zero or not, but I doubt that the round trip time average > (RTT > avg) should ever be negative. General rule of thumb for C is to keep > arithmetic signed (even when working with non zero values), so rather > than make the literal (6666) a unsigned long, I agree with your > change > to keep the division signed as well. Thanks for the fix. > Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Thanks for the patch and for the review. I've applied this to our internal tree and it will be sent upstreaming following our normal upstreaming process. -- Cheers, Luca.