Skip to content

Commit

Permalink
drivers: ethernet: eth_mcux: fix double-promotion warnings
Browse files Browse the repository at this point in the history
Some single-precision float constants were being compared against
double-precision floats. Make the constants doubles.

Signed-off-by: Ryan McClelland <[email protected]>
  • Loading branch information
XenuIsWatching authored and carlescufi committed May 2, 2023
1 parent 662f48a commit 272c4e9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/ethernet/eth_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1737,20 +1737,20 @@ static int ptp_clock_mcux_rate_adjust(const struct device *dev, double ratio)
ratio *= context->clk_ratio;

/* Limit possible ratio. */
if ((ratio > 1.0f + 1.0f/(2 * hw_inc)) ||
(ratio < 1.0f - 1.0f/(2 * hw_inc))) {
if ((ratio > 1.0 + 1.0/(2 * hw_inc)) ||
(ratio < 1.0 - 1.0/(2 * hw_inc))) {
return -EINVAL;
}

/* Save new ratio. */
context->clk_ratio = ratio;

if (ratio < 1.0f) {
if (ratio < 1.0) {
corr = hw_inc - 1;
val = 1.0f / (hw_inc * (1.0f - ratio));
} else if (ratio > 1.0f) {
val = 1.0 / (hw_inc * (1.0 - ratio));
} else if (ratio > 1.0) {
corr = hw_inc + 1;
val = 1.0f / (hw_inc * (ratio - 1.0f));
val = 1.0 / (hw_inc * (ratio - 1.0));
} else {
val = 0;
corr = hw_inc;
Expand Down

0 comments on commit 272c4e9

Please sign in to comment.