[PATCH v1 6/9] net: designware: Fix get_timer value overflow
Jim Liu
jim.t90615 at gmail.com
Tue Aug 5 11:18:47 CEST 2025
get_timer returns a ulong value representing system time in ms.
On a 64-bit system, this ulong value is 64 bits long. However,
the driver stores it in a 32-bit unsigned integer, which overflows
after 49 days up time, causing the driver to get an incorrect time.
Replace the unsigned int variable with a ulong type to properly store
the value returned by get_timer.
Signed-off-by: Jim Liu <JJLIU0 at nuvoton.com>
---
drivers/net/designware.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index fce3ef910cb..49b1f6f2c92 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -532,7 +532,7 @@ int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)
{
struct eth_mac_regs *mac_p = priv->mac_regs_p;
struct eth_dma_regs *dma_p = priv->dma_regs_p;
- unsigned int start;
+ ulong start;
int ret;
writel(readl(&dma_p->busmode) | DMAMAC_SRST, &dma_p->busmode);
--
2.34.1
More information about the U-Boot
mailing list