Give it a few tries, then exit. Prevents a possible endless loop
situation.
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
struct IR *ir = filep->private_data;
struct IR_rx *rx;
struct lirc_buffer *rbuf = ir->l.rbuf;
- int ret = 0, written = 0;
+ int ret = 0, written = 0, retries = 0;
unsigned int m;
DECLARE_WAITQUEUE(wait, current);
ret = copy_to_user((void *)outbuf+written, buf,
rbuf->chunk_size);
written += rbuf->chunk_size;
+ } else {
+ retries++;
+ }
+ if (retries >= 5) {
+ zilog_error("Buffer read failed!\n");
+ ret = -EIO;
}
}
}