[PATCH RESEND] drm: fix case where panic notifier isn't unregistered

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The framebuffer helper panic notifier is unregistered, in drm_fb_helper_fini(), when kernel_fb_helper_list goes from being non-empty to empty. However, in drm_fb_helper_single_fb_probe(), it's possible for the panic notifier to be registered without an element being added to this list if a driver's probe function returns 0. Make sure that an attempt to add the panic notifier is made only when adding an element to kernel_fb_helper_list.

Signed-off-by: Frank Binns <frank.binns@xxxxxxxxxx>
---
This should hopefully have none of the whitespace damage introduced by my email client last time.

 drivers/gpu/drm/drm_fb_helper.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index a0d6e89..d3764b3 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -807,21 +807,20 @@ int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
 		printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
 		       info->fix.id);
 
+		/* Switch back to kernel console on panic */
+		/* multi card linked list maybe */
+		if (list_empty(&kernel_fb_helper_list)) {
+			printk(KERN_INFO "drm: registered panic notifier\n");
+			atomic_notifier_chain_register(&panic_notifier_list,
+						       &paniced);
+			register_sysrq_key('v', &sysrq_drm_fb_helper_restore_op);
+		}
+
+		list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list);
 	} else {
 		drm_fb_helper_set_par(info);
 	}
 
-	/* Switch back to kernel console on panic */
-	/* multi card linked list maybe */
-	if (list_empty(&kernel_fb_helper_list)) {
-		printk(KERN_INFO "drm: registered panic notifier\n");
-		atomic_notifier_chain_register(&panic_notifier_list,
-					       &paniced);
-		register_sysrq_key('v', &sysrq_drm_fb_helper_restore_op);
-	}
-	if (new_fb)
-		list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list);
-
 	return 0;
 }
 EXPORT_SYMBOL(drm_fb_helper_single_fb_probe);
-- 
1.7.5.4


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux