[media] lg2160: fix off-by-one error in lg216x_write_regs
authorMichael Krufky <mkrufky@linuxtv.org>
Mon, 21 May 2012 15:28:14 +0000 (12:28 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 11 Jun 2012 18:59:16 +0000 (15:59 -0300)
Fix an off-by-one error in lg216x_write_regs, causing the last element
of the lg216x init block to be ignored.  Spotted by Dan Carpenter.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/lg2160.c

index a3ab1a5b6597fd71933639489d9769c91e42ef8a..cc11260e99df96f7ce19837e6ba268811aa825cf 100644 (file)
@@ -126,7 +126,7 @@ static int lg216x_write_regs(struct lg216x_state *state,
 
        lg_reg("writing %d registers...\n", len);
 
-       for (i = 0; i < len - 1; i++) {
+       for (i = 0; i < len; i++) {
                ret = lg216x_write_reg(state, regs[i].reg, regs[i].val);
                if (lg_fail(ret))
                        return ret;