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>
This commit is contained in:
parent
3e3c486012
commit
286e5b97eb
@ -114,6 +114,7 @@ int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int ret = -EIO;
|
int ret = -EIO;
|
||||||
int i;
|
int i;
|
||||||
|
int restarts = 0;
|
||||||
|
|
||||||
spin_lock_irqsave(&ec_lock, flags);
|
spin_lock_irqsave(&ec_lock, flags);
|
||||||
|
|
||||||
@ -169,7 +170,9 @@ restart:
|
|||||||
if (wait_on_obf(0x6c, 1)) {
|
if (wait_on_obf(0x6c, 1)) {
|
||||||
printk(KERN_ERR "olpc-ec: timeout waiting for"
|
printk(KERN_ERR "olpc-ec: timeout waiting for"
|
||||||
" EC to provide data!\n");
|
" EC to provide data!\n");
|
||||||
goto restart;
|
if (restarts++ < 10)
|
||||||
|
goto restart;
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
outbuf[i] = inb(0x68);
|
outbuf[i] = inb(0x68);
|
||||||
pr_devel("olpc-ec: received 0x%x\n", outbuf[i]);
|
pr_devel("olpc-ec: received 0x%x\n", outbuf[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user