Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] tvp7002: Don't update device->streaming if write to register fails

This ensures device->streaming has correct status.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Axel Lin and committed by
Mauro Carvalho Chehab
18cb6503 a0ffe4c0

+8 -13
+8 -13
drivers/media/i2c/tvp7002.c
··· 775 775 static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable) 776 776 { 777 777 struct tvp7002 *device = to_tvp7002(sd); 778 - int error = 0; 778 + int error; 779 779 780 780 if (device->streaming == enable) 781 781 return 0; 782 782 783 - if (enable) { 784 - /* Set output state on (low impedance means stream on) */ 785 - error = tvp7002_write(sd, TVP7002_MISC_CTL_2, 0x00); 786 - device->streaming = enable; 787 - } else { 788 - /* Set output state off (high impedance means stream off) */ 789 - error = tvp7002_write(sd, TVP7002_MISC_CTL_2, 0x03); 790 - if (error) 791 - v4l2_dbg(1, debug, sd, "Unable to stop streaming\n"); 792 - 793 - device->streaming = enable; 783 + /* low impedance: on, high impedance: off */ 784 + error = tvp7002_write(sd, TVP7002_MISC_CTL_2, enable ? 0x00 : 0x03); 785 + if (error) { 786 + v4l2_dbg(1, debug, sd, "Fail to set streaming\n"); 787 + return error; 794 788 } 795 789 796 - return error; 790 + device->streaming = enable; 791 + return 0; 797 792 } 798 793 799 794 /*