media: drxj: better handle errors
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 1 Nov 2017 21:06:00 +0000 (17:06 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 11 Dec 2017 18:04:53 +0000 (13:04 -0500)
as reported by smatch:
drivers/media/dvb-frontends/drx39xyj/drxj.c:2157 drxj_dap_atomic_read_write_block() error: uninitialized symbol 'word'.

The driver doesn't check if a read error occurred. Add such
check.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/dvb-frontends/drx39xyj/drxj.c

index 8cbd8cc..77d3a44 100644 (file)
@@ -2151,9 +2151,13 @@ int drxj_dap_atomic_read_write_block(struct i2c_device_addr *dev_addr,
        if (read_flag) {
                /* read data from buffer */
                for (i = 0; i < (datasize / 2); i++) {
-                       drxj_dap_read_reg16(dev_addr,
-                                           (DRXJ_HI_ATOMIC_BUF_START + i),
-                                          &word, 0);
+                       rc = drxj_dap_read_reg16(dev_addr,
+                                                (DRXJ_HI_ATOMIC_BUF_START + i),
+                                                &word, 0);
+                       if (rc) {
+                               pr_err("error %d\n", rc);
+                               goto rw_error;
+                       }
                        data[2 * i] = (u8) (word & 0xFF);
                        data[(2 * i) + 1] = (u8) (word >> 8);
                }