[media] tda10071: do not download last byte of fw
authorAntti Palosaari <crope@iki.fi>
Tue, 13 Sep 2011 10:30:11 +0000 (07:30 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 21 Sep 2011 13:09:00 +0000 (10:09 -0300)
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/tda10071.c

index 26b52cc83c617a0d2802ef22e2b52fc488a7bfa0..352ddc656ad606a6a8bcdcbf7ca6d29ae3edd4e2 100644 (file)
@@ -839,7 +839,7 @@ static int tda10071_init(struct dvb_frontend *fe)
 {
        struct tda10071_priv *priv = fe->demodulator_priv;
        struct tda10071_cmd cmd;
-       int ret, i, len, remaining;
+       int ret, i, len, remaining, fw_size;
        const struct firmware *fw;
        u8 *fw_file = TDA10071_DEFAULT_FIRMWARE;
        u8 tmp, buf[4];
@@ -968,14 +968,17 @@ static int tda10071_init(struct dvb_frontend *fe)
 
                info("downloading firmware from file '%s'", fw_file);
 
-               for (remaining = fw->size; remaining > 0;
+               /* do not download last byte */
+               fw_size = fw->size - 1;
+
+               for (remaining = fw_size; remaining > 0;
                        remaining -= (priv->cfg.i2c_wr_max - 1)) {
                        len = remaining;
                        if (len > (priv->cfg.i2c_wr_max - 1))
                                len = (priv->cfg.i2c_wr_max - 1);
 
                        ret = tda10071_wr_regs(priv, 0xfa,
-                               (u8 *) &fw->data[fw->size - remaining], len);
+                               (u8 *) &fw->data[fw_size - remaining], len);
                        if (ret) {
                                err("firmware download failed=%d", ret);
                                if (ret)