]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] tvp5150: return I2C write operation failure to callers
authorJavier Martinez Canillas <javier@osg.samsung.com>
Fri, 15 Apr 2016 01:00:07 +0000 (22:00 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 9 May 2016 17:44:16 +0000 (14:44 -0300)
The tvp5150_write() function calls i2c_smbus_write_byte_data() that
can fail but does not propagate the error to the caller. Instead it
just prints a debug, so callers can't know if the operation failed.

So change the function to return the error code to the caller so it
knows that the write failed and also print an error instead of just
printing a debug information.

While being there remove the inline keyword from tvp5150_write() to
make it consistent with tvp5150_read() and also because it's called
in a lot of places, so making inline is in fact counter productive
since it makes the kernel image size to be much bigger (~16 KiB).

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/tvp5150.c

index ff18444e19e4828418e5ec6cf75747b19dc5c4f5..283836514e6afe679c075407ce55c541a6330859 100644 (file)
@@ -83,7 +83,7 @@ static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr)
        return rc;
 }
 
-static inline void tvp5150_write(struct v4l2_subdev *sd, unsigned char addr,
+static int tvp5150_write(struct v4l2_subdev *sd, unsigned char addr,
                                 unsigned char value)
 {
        struct i2c_client *c = v4l2_get_subdevdata(sd);
@@ -92,7 +92,9 @@ static inline void tvp5150_write(struct v4l2_subdev *sd, unsigned char addr,
        v4l2_dbg(2, debug, sd, "tvp5150: writing 0x%02x 0x%02x\n", addr, value);
        rc = i2c_smbus_write_byte_data(c, addr, value);
        if (rc < 0)
-               v4l2_dbg(0, debug, sd, "i2c i/o error: rc == %d\n", rc);
+               v4l2_err(sd, "i2c i/o error: rc == %d\n", rc);
+
+       return rc;
 }
 
 static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init,