diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index eebfd6976aaa..154cc0c7623d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -762,7 +762,7 @@ static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv) /* Receive Interrupt Watchdog Timer (riwt) has a resolution of 256 * ticks. */ - return (usec * (clk / USEC_PER_SEC)) / 256; + return DIV_ROUND_CLOSEST(usec * (clk / USEC_PER_SEC), 256); } static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv) @@ -775,7 +775,7 @@ static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv) return 0; } - return (riwt * 256) / (clk / USEC_PER_SEC); + return DIV_ROUND_CLOSEST(riwt * 256, clk / USEC_PER_SEC); } static int __stmmac_get_coalesce(struct net_device *dev,