aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorPaul Fox <pgf@laptop.org>2010-10-01 13:17:19 -0400
committerIngo Molnar <mingo@elte.hu>2010-10-08 04:06:09 -0400
commit286e5b97eb22baab9d9a41ca76c6b933a484252c (patch)
tree41c30e43ed2566b7c4f0bc7c935fa44a8fc39d43 /arch/x86/kernel
parent3e3c486012a3dbb113c0ca15ee265d309d77aea9 (diff)
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')
-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,
114 unsigned long flags; 114 unsigned long flags;
115 int ret = -EIO; 115 int ret = -EIO;
116 int i; 116 int i;
117 int restarts = 0;
117 118
118 spin_lock_irqsave(&ec_lock, flags); 119 spin_lock_irqsave(&ec_lock, flags);
119 120
@@ -169,7 +170,9 @@ restart:
169 if (wait_on_obf(0x6c, 1)) { 170 if (wait_on_obf(0x6c, 1)) {
170 printk(KERN_ERR "olpc-ec: timeout waiting for" 171 printk(KERN_ERR "olpc-ec: timeout waiting for"
171 " EC to provide data!\n"); 172 " EC to provide data!\n");
172 goto restart; 173 if (restarts++ < 10)
174 goto restart;
175 goto err;
173 } 176 }
174 outbuf[i] = inb(0x68); 177 outbuf[i] = inb(0x68);
175 pr_devel("olpc-ec: received 0x%x\n", outbuf[i]); 178 pr_devel("olpc-ec: received 0x%x\n", outbuf[i]);