diff options
author | Erik Andrén <erik.andren@gmail.com> | 2008-11-20 01:46:55 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:39:46 -0500 |
commit | 8bcbc91149bf77dfcc079be911289221f2755b3f (patch) | |
tree | 66bfba65420e931416efb0dccf99b0e20d81ae89 /drivers | |
parent | 619a4d5ca127e80583fb9d269681164363be983e (diff) |
V4L/DVB (10002): m5602: Simplify error handling in the mt9m111 sensor code
Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_mt9m111.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/drivers/media/video/gspca/m5602/m5602_mt9m111.c index fb700c2d055a..c93e7474e59a 100644 --- a/drivers/media/video/gspca/m5602/m5602_mt9m111.c +++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.c | |||
@@ -72,7 +72,7 @@ int mt9m111_init(struct sd *sd) | |||
72 | int i, err = 0; | 72 | int i, err = 0; |
73 | 73 | ||
74 | /* Init the sensor */ | 74 | /* Init the sensor */ |
75 | for (i = 0; i < ARRAY_SIZE(init_mt9m111); i++) { | 75 | for (i = 0; i < ARRAY_SIZE(init_mt9m111) && !err; i++) { |
76 | u8 data[2]; | 76 | u8 data[2]; |
77 | 77 | ||
78 | if (init_mt9m111[i][0] == BRIDGE) { | 78 | if (init_mt9m111[i][0] == BRIDGE) { |
@@ -109,7 +109,7 @@ int mt9m111_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) | |||
109 | *val = data[0] & MT9M111_RMB_MIRROR_ROWS; | 109 | *val = data[0] & MT9M111_RMB_MIRROR_ROWS; |
110 | PDEBUG(D_V4L2, "Read vertical flip %d", *val); | 110 | PDEBUG(D_V4L2, "Read vertical flip %d", *val); |
111 | 111 | ||
112 | return (err < 0) ? err : 0; | 112 | return err; |
113 | } | 113 | } |
114 | 114 | ||
115 | int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val) | 115 | int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val) |
@@ -133,7 +133,7 @@ int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val) | |||
133 | err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B, | 133 | err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B, |
134 | data, 2); | 134 | data, 2); |
135 | out: | 135 | out: |
136 | return (err < 0) ? err : 0; | 136 | return err; |
137 | } | 137 | } |
138 | 138 | ||
139 | int mt9m111_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) | 139 | int mt9m111_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -147,7 +147,7 @@ int mt9m111_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) | |||
147 | *val = data[0] & MT9M111_RMB_MIRROR_COLS; | 147 | *val = data[0] & MT9M111_RMB_MIRROR_COLS; |
148 | PDEBUG(D_V4L2, "Read horizontal flip %d", *val); | 148 | PDEBUG(D_V4L2, "Read horizontal flip %d", *val); |
149 | 149 | ||
150 | return (err < 0) ? err : 0; | 150 | return err; |
151 | } | 151 | } |
152 | 152 | ||
153 | int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val) | 153 | int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val) |
@@ -171,7 +171,7 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val) | |||
171 | err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B, | 171 | err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B, |
172 | data, 2); | 172 | data, 2); |
173 | out: | 173 | out: |
174 | return (err < 0) ? err : 0; | 174 | return err; |
175 | } | 175 | } |
176 | 176 | ||
177 | int mt9m111_get_gain(struct gspca_dev *gspca_dev, __s32 *val) | 177 | int mt9m111_get_gain(struct gspca_dev *gspca_dev, __s32 *val) |
@@ -190,7 +190,7 @@ int mt9m111_get_gain(struct gspca_dev *gspca_dev, __s32 *val) | |||
190 | 190 | ||
191 | PDEBUG(D_V4L2, "Read gain %d", *val); | 191 | PDEBUG(D_V4L2, "Read gain %d", *val); |
192 | 192 | ||
193 | return (err < 0) ? err : 0; | 193 | return err; |
194 | } | 194 | } |
195 | 195 | ||
196 | int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val) | 196 | int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val) |
@@ -228,7 +228,7 @@ int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val) | |||
228 | err = mt9m111_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN, | 228 | err = mt9m111_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN, |
229 | data, 2); | 229 | data, 2); |
230 | out: | 230 | out: |
231 | return (err < 0) ? err : 0; | 231 | return err; |
232 | } | 232 | } |
233 | 233 | ||
234 | int mt9m111_read_sensor(struct sd *sd, const u8 address, | 234 | int mt9m111_read_sensor(struct sd *sd, const u8 address, |
@@ -261,7 +261,7 @@ int mt9m111_read_sensor(struct sd *sd, const u8 address, | |||
261 | "0x%x contains 0x%x ", address, *i2c_data); | 261 | "0x%x contains 0x%x ", address, *i2c_data); |
262 | } | 262 | } |
263 | out: | 263 | out: |
264 | return (err < 0) ? err : 0; | 264 | return err; |
265 | } | 265 | } |
266 | 266 | ||
267 | int mt9m111_write_sensor(struct sd *sd, const u8 address, | 267 | int mt9m111_write_sensor(struct sd *sd, const u8 address, |