Skip to content

Commit c9e0876

Browse files
Tomasz Bursztykanashif
authored andcommitted
drivers/pwm: Fix abs() usage in xec driver
Seems to be fine to temporarly cast to int there as frequencies are in Mhz and not Ghz. Fixes #20497 Coverity CID: 205638 Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 7022000 commit c9e0876

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/pwm/pwm_mchp_xec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ static struct xec_params *xec_compare_params(u32_t target_freq,
216216
lc_params->off);
217217
}
218218

219-
if (abs(target_freq - freq_h) < abs(target_freq - freq_l)) {
219+
if (abs((int)target_freq - (int)freq_h) <
220+
abs((int)target_freq - (int)freq_l)) {
220221
params = hc_params;
221222
} else {
222223
params = lc_params;

0 commit comments

Comments
 (0)