aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-10-18 09:20:25 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-21 12:20:47 -0400
commit9b4a7c8a83899ef7742f63c0e9a8a28cbff2c29a (patch)
tree46c9bb40a4734d5a0a4769c8e4b6599ec40c84d6 /drivers/media/video
parent06869713de3e6380b2f24d9eac30426b4e471375 (diff)
V4L/DVB (9299): cx18: Don't mask many real init error codes by mapping them to ENOMEM
Changes to let error return codes bubble up to the user visible error message on card initialization. A number of them were being remapped to ENOMEM when no memory or array resource shortage existed. That hampered diagnosis of user trouble reports. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c3
-rw-r--r--drivers/media/video/cx18/cx18-streams.c36
2 files changed, 24 insertions, 15 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index ef60f561d956..7a1a7830a6b3 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -699,7 +699,8 @@ static int __devinit cx18_probe(struct pci_dev *dev,
699 699
700 /* active i2c */ 700 /* active i2c */
701 CX18_DEBUG_INFO("activating i2c...\n"); 701 CX18_DEBUG_INFO("activating i2c...\n");
702 if (init_cx18_i2c(cx)) { 702 retval = init_cx18_i2c(cx);
703 if (retval) {
703 CX18_ERR("Could not initialize i2c\n"); 704 CX18_ERR("Could not initialize i2c\n");
704 goto free_map; 705 goto free_map;
705 } 706 }
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 0c8e7542cf60..e5ff7705b7a1 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -200,16 +200,18 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
200/* Initialize v4l2 variables and register v4l2 devices */ 200/* Initialize v4l2 variables and register v4l2 devices */
201int cx18_streams_setup(struct cx18 *cx) 201int cx18_streams_setup(struct cx18 *cx)
202{ 202{
203 int type; 203 int type, ret;
204 204
205 /* Setup V4L2 Devices */ 205 /* Setup V4L2 Devices */
206 for (type = 0; type < CX18_MAX_STREAMS; type++) { 206 for (type = 0; type < CX18_MAX_STREAMS; type++) {
207 /* Prepare device */ 207 /* Prepare device */
208 if (cx18_prep_dev(cx, type)) 208 ret = cx18_prep_dev(cx, type);
209 if (ret < 0)
209 break; 210 break;
210 211
211 /* Allocate Stream */ 212 /* Allocate Stream */
212 if (cx18_stream_alloc(&cx->streams[type])) 213 ret = cx18_stream_alloc(&cx->streams[type]);
214 if (ret < 0)
213 break; 215 break;
214 } 216 }
215 if (type == CX18_MAX_STREAMS) 217 if (type == CX18_MAX_STREAMS)
@@ -217,14 +219,14 @@ int cx18_streams_setup(struct cx18 *cx)
217 219
218 /* One or more streams could not be initialized. Clean 'em all up. */ 220 /* One or more streams could not be initialized. Clean 'em all up. */
219 cx18_streams_cleanup(cx, 0); 221 cx18_streams_cleanup(cx, 0);
220 return -ENOMEM; 222 return ret;
221} 223}
222 224
223static int cx18_reg_dev(struct cx18 *cx, int type) 225static int cx18_reg_dev(struct cx18 *cx, int type)
224{ 226{
225 struct cx18_stream *s = &cx->streams[type]; 227 struct cx18_stream *s = &cx->streams[type];
226 int vfl_type = cx18_stream_info[type].vfl_type; 228 int vfl_type = cx18_stream_info[type].vfl_type;
227 int num; 229 int num, ret;
228 230
229 /* TODO: Shouldn't this be a VFL_TYPE_TRANSPORT or something? 231 /* TODO: Shouldn't this be a VFL_TYPE_TRANSPORT or something?
230 * We need a VFL_TYPE_TS defined. 232 * We need a VFL_TYPE_TS defined.
@@ -233,9 +235,10 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
233 /* just return if no DVB is supported */ 235 /* just return if no DVB is supported */
234 if ((cx->card->hw_all & CX18_HW_DVB) == 0) 236 if ((cx->card->hw_all & CX18_HW_DVB) == 0)
235 return 0; 237 return 0;
236 if (cx18_dvb_register(s) < 0) { 238 ret = cx18_dvb_register(s);
239 if (ret < 0) {
237 CX18_ERR("DVB failed to register\n"); 240 CX18_ERR("DVB failed to register\n");
238 return -EINVAL; 241 return ret;
239 } 242 }
240 } 243 }
241 244
@@ -252,12 +255,13 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
252 } 255 }
253 256
254 /* Register device. First try the desired minor, then any free one. */ 257 /* Register device. First try the desired minor, then any free one. */
255 if (video_register_device(s->v4l2dev, vfl_type, num)) { 258 ret = video_register_device(s->v4l2dev, vfl_type, num);
259 if (ret < 0) {
256 CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n", 260 CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n",
257 s->name, num); 261 s->name, num);
258 video_device_release(s->v4l2dev); 262 video_device_release(s->v4l2dev);
259 s->v4l2dev = NULL; 263 s->v4l2dev = NULL;
260 return -ENOMEM; 264 return ret;
261 } 265 }
262 num = s->v4l2dev->num; 266 num = s->v4l2dev->num;
263 267
@@ -290,18 +294,22 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
290int cx18_streams_register(struct cx18 *cx) 294int cx18_streams_register(struct cx18 *cx)
291{ 295{
292 int type; 296 int type;
293 int err = 0; 297 int err;
298 int ret = 0;
294 299
295 /* Register V4L2 devices */ 300 /* Register V4L2 devices */
296 for (type = 0; type < CX18_MAX_STREAMS; type++) 301 for (type = 0; type < CX18_MAX_STREAMS; type++) {
297 err |= cx18_reg_dev(cx, type); 302 err = cx18_reg_dev(cx, type);
303 if (err && ret == 0)
304 ret = err;
305 }
298 306
299 if (err == 0) 307 if (ret == 0)
300 return 0; 308 return 0;
301 309
302 /* One or more streams could not be initialized. Clean 'em all up. */ 310 /* One or more streams could not be initialized. Clean 'em all up. */
303 cx18_streams_cleanup(cx, 1); 311 cx18_streams_cleanup(cx, 1);
304 return -ENOMEM; 312 return ret;
305} 313}
306 314
307/* Unregister v4l2 devices */ 315/* Unregister v4l2 devices */