diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-08-25 15:45:11 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-09-08 13:45:50 +0200 |
commit | a39a357c6ca3c88ad64e9b51bd7607c06cd6d35d (patch) | |
tree | b1686469b650f06e45b0989648cfc2c9ea5b3bd5 /drivers/gpu/drm/drm_crtc.c | |
parent | b7bdf0a87add0fead1550533e328a290d8f9da6c (diff) | |
download | op-kernel-dev-a39a357c6ca3c88ad64e9b51bd7607c06cd6d35d.zip op-kernel-dev-a39a357c6ca3c88ad64e9b51bd7607c06cd6d35d.tar.gz |
drm: Make drm_fb_unregister/remove accept NULL fb
These functions are used by drivers to release fbdev emulation
buffers. We need to make them resilient to NULL pointers to
make the fbdev compile/runtime knobs not cause Oopses on module
unload.
Cc: Archit Taneja <architt@codeaurora.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 33d877c..884690c 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -538,7 +538,12 @@ EXPORT_SYMBOL(drm_framebuffer_reference); */ void drm_framebuffer_unregister_private(struct drm_framebuffer *fb) { - struct drm_device *dev = fb->dev; + struct drm_device *dev; + + if (!fb) + return; + + dev = fb->dev; mutex_lock(&dev->mode_config.fb_lock); /* Mark fb as reaped and drop idr ref. */ @@ -589,12 +594,17 @@ EXPORT_SYMBOL(drm_framebuffer_cleanup); */ void drm_framebuffer_remove(struct drm_framebuffer *fb) { - struct drm_device *dev = fb->dev; + struct drm_device *dev; struct drm_crtc *crtc; struct drm_plane *plane; struct drm_mode_set set; int ret; + if (!fb) + return; + + dev = fb->dev; + WARN_ON(!list_empty(&fb->filp_head)); /* |