Merge remote branch 'origin/master' into next
[oweals/u-boot.git] / drivers / mtd / cfi_flash.c
index 15a4220d4f3bb191b8172710491e2d6df4700697..d0240f55d4996fe8148b9950dd2eb47ca85b845d 100644 (file)
@@ -537,7 +537,10 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,
        ulong start;
 
 #if CONFIG_SYS_HZ != 1000
-       tout *= CONFIG_SYS_HZ/1000;
+       if ((ulong)CONFIG_SYS_HZ > 100000)
+               tout *= (ulong)CONFIG_SYS_HZ / 1000;  /* for a big HZ, avoid overflow */
+       else
+               tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000);
 #endif
 
        /* Wait for command completion */