[PATCH RESEND] drm: fix case where panic notifier isn't unregistered
Frank Binns
Frank.Binns at imgtec.com
Thu May 24 06:37:53 PDT 2012
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 at imgtec.com>
---
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
More information about the dri-devel
mailing list