V4L/DVB (6343): ivtvfb: check return value of unregister_framebuffer
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 14 Oct 2007 14:17:14 +0000 (11:17 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Mon, 22 Oct 2007 14:01:47 +0000 (12:01 -0200)
Prevent unloading the framebuffer if it is still in use.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/ivtv/ivtvfb.c

index 0abca6bec7d45d0147860890bdd1e413d1660344..4a7512d90bc92babbe37b2eeda36e7042a3db223 100644 (file)
@@ -1169,9 +1169,12 @@ static void ivtvfb_cleanup(void)
        for (i = 0; i < ivtv_cards_active; i++) {
                itv = ivtv_cards[i];
                if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) && itv->osd_info) {
+                       if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) {
+                               IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n", i);
+                               return;
+                       }
                        IVTVFB_DEBUG_INFO("Unregister framebuffer %d\n", i);
                        ivtvfb_blank(FB_BLANK_POWERDOWN, &itv->osd_info->ivtvfb_info);
-                       unregister_framebuffer(&itv->osd_info->ivtvfb_info);
                        ivtvfb_release_buffers(itv);
                        itv->osd_video_pbase = 0;
                }