aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tw9910.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/tw9910.c')
-rw-r--r--drivers/media/video/tw9910.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 75cfde02d026..d5cdc4be1a35 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -651,7 +651,7 @@ static int tw9910_set_fmt(struct soc_camera_device *icd, __u32 pixfmt,
651 */ 651 */
652 priv->scale = tw9910_select_norm(icd, rect->width, rect->height); 652 priv->scale = tw9910_select_norm(icd, rect->width, rect->height);
653 if (!priv->scale) 653 if (!priv->scale)
654 return ret; 654 goto tw9910_set_fmt_error;
655 655
656 /* 656 /*
657 * reset hardware 657 * reset hardware
@@ -659,7 +659,8 @@ static int tw9910_set_fmt(struct soc_camera_device *icd, __u32 pixfmt,
659 tw9910_reset(priv->client); 659 tw9910_reset(priv->client);
660 ret = tw9910_write_array(priv->client, tw9910_default_regs); 660 ret = tw9910_write_array(priv->client, tw9910_default_regs);
661 if (ret < 0) 661 if (ret < 0)
662 return ret; 662 goto tw9910_set_fmt_error;
663
663 /* 664 /*
664 * set bus width 665 * set bus width
665 */ 666 */
@@ -669,7 +670,7 @@ static int tw9910_set_fmt(struct soc_camera_device *icd, __u32 pixfmt,
669 670
670 ret = tw9910_mask_set(priv->client, OPFORM, LEN, val); 671 ret = tw9910_mask_set(priv->client, OPFORM, LEN, val);
671 if (ret < 0) 672 if (ret < 0)
672 return ret; 673 goto tw9910_set_fmt_error;
673 674
674 /* 675 /*
675 * select MPOUT behavior 676 * select MPOUT behavior
@@ -697,26 +698,35 @@ static int tw9910_set_fmt(struct soc_camera_device *icd, __u32 pixfmt,
697 698
698 ret = tw9910_mask_set(priv->client, VBICNTL, RTSEL_MASK, val); 699 ret = tw9910_mask_set(priv->client, VBICNTL, RTSEL_MASK, val);
699 if (ret < 0) 700 if (ret < 0)
700 return ret; 701 goto tw9910_set_fmt_error;
701 702
702 /* 703 /*
703 * set scale 704 * set scale
704 */ 705 */
705 ret = tw9910_set_scale(priv->client, priv->scale); 706 ret = tw9910_set_scale(priv->client, priv->scale);
706 if (ret < 0) 707 if (ret < 0)
707 return ret; 708 goto tw9910_set_fmt_error;
708 709
709 /* 710 /*
710 * set cropping 711 * set cropping
711 */ 712 */
712 ret = tw9910_set_cropping(priv->client, &tw9910_cropping_ctrl); 713 ret = tw9910_set_cropping(priv->client, &tw9910_cropping_ctrl);
713 if (ret < 0) 714 if (ret < 0)
714 return ret; 715 goto tw9910_set_fmt_error;
715 716
716 /* 717 /*
717 * set hsync 718 * set hsync
718 */ 719 */
719 ret = tw9910_set_hsync(priv->client, &tw9910_hsync_ctrl); 720 ret = tw9910_set_hsync(priv->client, &tw9910_hsync_ctrl);
721 if (ret < 0)
722 goto tw9910_set_fmt_error;
723
724 return ret;
725
726tw9910_set_fmt_error:
727
728 tw9910_reset(priv->client);
729 priv->scale = NULL;
720 730
721 return ret; 731 return ret;
722} 732}