diff options
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r-- | drivers/media/video/soc_camera.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 3fb533c4d33..39886437026 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -363,8 +363,6 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd) | |||
363 | if (!icd->user_formats) | 363 | if (!icd->user_formats) |
364 | return -ENOMEM; | 364 | return -ENOMEM; |
365 | 365 | ||
366 | icd->num_user_formats = fmts; | ||
367 | |||
368 | dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); | 366 | dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); |
369 | 367 | ||
370 | /* Second pass - actually fill data formats */ | 368 | /* Second pass - actually fill data formats */ |
@@ -372,9 +370,10 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd) | |||
372 | for (i = 0; i < raw_fmts; i++) | 370 | for (i = 0; i < raw_fmts; i++) |
373 | if (!ici->ops->get_formats) { | 371 | if (!ici->ops->get_formats) { |
374 | v4l2_subdev_call(sd, video, enum_mbus_fmt, i, &code); | 372 | v4l2_subdev_call(sd, video, enum_mbus_fmt, i, &code); |
375 | icd->user_formats[i].host_fmt = | 373 | icd->user_formats[fmts].host_fmt = |
376 | soc_mbus_get_fmtdesc(code); | 374 | soc_mbus_get_fmtdesc(code); |
377 | icd->user_formats[i].code = code; | 375 | if (icd->user_formats[fmts].host_fmt) |
376 | icd->user_formats[fmts++].code = code; | ||
378 | } else { | 377 | } else { |
379 | ret = ici->ops->get_formats(icd, i, | 378 | ret = ici->ops->get_formats(icd, i, |
380 | &icd->user_formats[fmts]); | 379 | &icd->user_formats[fmts]); |
@@ -383,12 +382,12 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd) | |||
383 | fmts += ret; | 382 | fmts += ret; |
384 | } | 383 | } |
385 | 384 | ||
385 | icd->num_user_formats = fmts; | ||
386 | icd->current_fmt = &icd->user_formats[0]; | 386 | icd->current_fmt = &icd->user_formats[0]; |
387 | 387 | ||
388 | return 0; | 388 | return 0; |
389 | 389 | ||
390 | egfmt: | 390 | egfmt: |
391 | icd->num_user_formats = 0; | ||
392 | vfree(icd->user_formats); | 391 | vfree(icd->user_formats); |
393 | return ret; | 392 | return ret; |
394 | } | 393 | } |