summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/olpc.c
diff options
context:
space:
mode:
authorPaul Fox2010-10-01 19:17:19 +0200
committerIngo Molnar2010-10-08 10:06:09 +0200
commit286e5b97eb22baab9d9a41ca76c6b933a484252c (patch)
tree41c30e43ed2566b7c4f0bc7c935fa44a8fc39d43 /arch/x86/kernel/olpc.c
parentx86, olpc: Rework BIOS signature check (diff)
downloadkernel-qcow2-linux-286e5b97eb22baab9d9a41ca76c6b933a484252c.tar.gz
kernel-qcow2-linux-286e5b97eb22baab9d9a41ca76c6b933a484252c.tar.xz
kernel-qcow2-linux-286e5b97eb22baab9d9a41ca76c6b933a484252c.zip
x86, olpc: Don't retry EC commands forever
Avoids a potential infinite loop. It was observed once, during an EC hacking/debugging session - not in regular operation. Signed-off-by: Daniel Drake <dsd@laptop.org> Cc: dilinger@queued.net Cc: <stable@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/olpc.c')
-rw-r--r--arch/x86/kernel/olpc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c
index 37c49934c785..747261302598 100644
--- a/arch/x86/kernel/olpc.c
+++ b/arch/x86/kernel/olpc.c
@@ -114,6 +114,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);
@@ -169,7 +170,9 @@ restart:
if (wait_on_obf(0x6c, 1)) {
printk(KERN_ERR "olpc-ec: timeout waiting for"
" EC to provide data!\n");
- goto restart;
+ if (restarts++ < 10)
+ goto restart;
+ goto err;
}
outbuf[i] = inb(0x68);
pr_devel("olpc-ec: received 0x%x\n", outbuf[i]);