drivers: ethernet: eth_mcux: fix double-promotion warnings

Some single-precision float constants were being compared against
double-precision floats. Make the constants doubles.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This commit is contained in:
Ryan McClelland 2023-04-26 10:24:04 -07:00 committed by Carles Cufí
commit 272c4e9a8d

View file

@ -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;