summaryrefslogtreecommitdiffstats
path: root/scripts/kwboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kwboot.c')
-rw-r--r--scripts/kwboot.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 60e8a69d18..2a4f6bc5fc 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -22,6 +22,7 @@
#include <termios.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <sys/select.h>
/*
* Marvell BootROM UART Sensing
@@ -147,12 +148,11 @@ kwboot_tty_recv(int fd, void *buf, size_t len, int timeo)
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
- tv.tv_sec = 0;
tv.tv_usec = timeo * 1000;
- if (tv.tv_usec > 1000000) {
- tv.tv_sec += tv.tv_usec / 1000000;
- tv.tv_usec %= 1000000;
- }
+
+ /* normalize timeval */
+ tv.tv_sec = tv.tv_usec / 1000000;
+ tv.tv_usec %= 1000000;
do {
nfds = select(fd + 1, &rfds, NULL, NULL, &tv);