Commit f86bbe3d authored by Paul Fox's avatar Paul Fox Committed by Greg Kroah-Hartman

x86, olpc: Don't retry EC commands forever

commit 286e5b97 upstream.

Avoids a potential infinite loop.

It was observed once, during an EC hacking/debugging
session - not in regular operation.
Signed-off-by: default avatarDaniel Drake <dsd@laptop.org>
Cc: dilinger@queued.net
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ae832c21
......@@ -115,6 +115,7 @@ int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
unsigned long flags;
int ret = -EIO;
int i;
int restarts = 0;
spin_lock_irqsave(&ec_lock, flags);
......@@ -171,7 +172,9 @@ int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
if (wait_on_obf(0x6c, 1)) {
printk(KERN_ERR "olpc-ec: timeout waiting for"
" EC to provide data!\n");
if (restarts++ < 10)
goto restart;
goto err;
}
outbuf[i] = inb(0x68);
printk(KERN_DEBUG "olpc-ec: received 0x%x\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment