diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-streams.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-streams.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 4ab8d36831ba..c47c2b945147 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -244,7 +244,7 @@ int ivtv_streams_setup(struct ivtv *itv) | |||
244 | return 0; | 244 | return 0; |
245 | 245 | ||
246 | /* One or more streams could not be initialized. Clean 'em all up. */ | 246 | /* One or more streams could not be initialized. Clean 'em all up. */ |
247 | ivtv_streams_cleanup(itv); | 247 | ivtv_streams_cleanup(itv, 0); |
248 | return -ENOMEM; | 248 | return -ENOMEM; |
249 | } | 249 | } |
250 | 250 | ||
@@ -304,12 +304,12 @@ int ivtv_streams_register(struct ivtv *itv) | |||
304 | return 0; | 304 | return 0; |
305 | 305 | ||
306 | /* One or more streams could not be initialized. Clean 'em all up. */ | 306 | /* One or more streams could not be initialized. Clean 'em all up. */ |
307 | ivtv_streams_cleanup(itv); | 307 | ivtv_streams_cleanup(itv, 1); |
308 | return -ENOMEM; | 308 | return -ENOMEM; |
309 | } | 309 | } |
310 | 310 | ||
311 | /* Unregister v4l2 devices */ | 311 | /* Unregister v4l2 devices */ |
312 | void ivtv_streams_cleanup(struct ivtv *itv) | 312 | void ivtv_streams_cleanup(struct ivtv *itv, int unregister) |
313 | { | 313 | { |
314 | int type; | 314 | int type; |
315 | 315 | ||
@@ -322,8 +322,11 @@ void ivtv_streams_cleanup(struct ivtv *itv) | |||
322 | continue; | 322 | continue; |
323 | 323 | ||
324 | ivtv_stream_free(&itv->streams[type]); | 324 | ivtv_stream_free(&itv->streams[type]); |
325 | /* Unregister device */ | 325 | /* Unregister or release device */ |
326 | video_unregister_device(vdev); | 326 | if (unregister) |
327 | video_unregister_device(vdev); | ||
328 | else | ||
329 | video_device_release(vdev); | ||
327 | } | 330 | } |
328 | } | 331 | } |
329 | 332 | ||