From 862c7bfc6041f06b6a2e398c68eea2563817f3af Mon Sep 17 00:00:00 2001 From: Ralph Metzler Date: Mon, 24 Jul 2017 22:24:13 +0200 Subject: [PATCH] check for error during write --- frontends/cxd2099.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontends/cxd2099.c b/frontends/cxd2099.c index 84ee296..c6685cc 100644 --- a/frontends/cxd2099.c +++ b/frontends/cxd2099.c @@ -662,15 +662,19 @@ static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) { struct cxd *ci = ca->data; - + int status; + if (ci->write_busy) return -EAGAIN; mutex_lock(&ci->lock); write_reg(ci, 0x0d, ecount >> 8); write_reg(ci, 0x0e, ecount & 0xff); - write_block(ci, 0x11, ebuf, ecount); - ci->write_busy = 1; + status = write_block(ci, 0x11, ebuf, ecount); + if (!status) + ci->write_busy = 1; mutex_unlock(&ci->lock); + if (status) + return status; return ecount; } #endif