summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-11-16 11:24:59 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-11-16 11:24:59 +0000
commiteb7365b86928eaf51db717fd510590c688436513 (patch)
tree57e344fe1bc939c62a35967cd338b924ce620fc6 /sys/dev/pci/drm
parent29a43e82d96fb473579c6587f94c5c2df6dddd77 (diff)
Don't attempt to restore the framebuffer mode in radeon_driver_lastclose_kms()
if the mode config stuff has not been initialized yet. Fixes a panic that happens when radeondrm(4) detaches because the hardware couldn't be initialized properly. Tested by Lubos Boucek.
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/radeon/radeon_kms.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c
index 3c9fc16f5ca..b1885e39f96 100644
--- a/sys/dev/pci/drm/radeon/radeon_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_kms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_kms.c,v 1.42 2015/09/27 16:13:23 kettenis Exp $ */
+/* $OpenBSD: radeon_kms.c,v 1.43 2015/11/16 11:24:58 kettenis Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -1091,13 +1091,16 @@ int radeon_driver_firstopen_kms(struct drm_device *dev)
void radeon_driver_lastclose_kms(struct drm_device *dev)
{
struct radeon_device *rdev = dev->dev_private;
+ struct drm_fb_helper *fb_helper = (void *)rdev->mode_info.rfbdev;
#ifdef __sparc64__
fbwscons_setcolormap(&rdev->sf, radeondrm_setcolor);
#endif
- drm_modeset_lock_all(dev);
- drm_fb_helper_restore_fbdev_mode((void *)rdev->mode_info.rfbdev);
- drm_modeset_unlock_all(dev);
+ if (rdev->mode_info.mode_config_initialized) {
+ drm_modeset_lock_all(dev);
+ drm_fb_helper_restore_fbdev_mode(fb_helper);
+ drm_modeset_unlock_all(dev);
+ }
#ifdef notyet
vga_switcheroo_process_delayed_switch();
#endif