drm/radeon/kms: fix oops when set_base is call with no FB
authorJerome Glisse <jglisse@redhat.com>
Tue, 17 Nov 2009 22:08:55 +0000 (14:08 -0800)
committerDave Airlie <airlied@redhat.com>
Wed, 2 Dec 2009 01:37:08 +0000 (11:37 +1000)
Just do nothing if crct_set_base() is called with no FB.

The oops happens when the user switches between X & vt or in some case
when changing mode.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/atombios_crtc.c
drivers/gpu/drm/radeon/radeon_legacy_crtc.c

index c15287a590ffca7395784f78ff763883b1e739ce..f5987afcd48d28aaa093a87e013e8f685a2e3e9a 100644 (file)
@@ -578,8 +578,11 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
        uint64_t fb_location;
        uint32_t fb_format, fb_pitch_pixels, tiling_flags;
 
-       if (!crtc->fb)
-               return -EINVAL;
+       /* no fb bound */
+       if (!crtc->fb) {
+               DRM_DEBUG("No FB bound\n");
+               return 0;
+       }
 
        radeon_fb = to_radeon_framebuffer(crtc->fb);
 
index 8d0b7aa87fa4da95ee94415460641e974686e1b0..5794364ff85743ad31e281ef35153ce418188895 100644 (file)
@@ -408,6 +408,11 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
        uint32_t gen_cntl_reg, gen_cntl_val;
 
        DRM_DEBUG("\n");
+       /* no fb bound */
+       if (!crtc->fb) {
+               DRM_DEBUG("No FB bound\n");
+               return 0;
+       }
 
        radeon_fb = to_radeon_framebuffer(crtc->fb);