aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index dff205849b34..3d13ca6e257f 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -168,6 +168,9 @@ static void drm_fb_helper_save_lut_atomic(struct drm_crtc *crtc, struct drm_fb_h
168 uint16_t *r_base, *g_base, *b_base; 168 uint16_t *r_base, *g_base, *b_base;
169 int i; 169 int i;
170 170
171 if (helper->funcs->gamma_get == NULL)
172 return;
173
171 r_base = crtc->gamma_store; 174 r_base = crtc->gamma_store;
172 g_base = r_base + crtc->gamma_size; 175 g_base = r_base + crtc->gamma_size;
173 b_base = g_base + crtc->gamma_size; 176 b_base = g_base + crtc->gamma_size;
@@ -597,6 +600,14 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
597 return 0; 600 return 0;
598 } 601 }
599 602
603 /*
604 * The driver really shouldn't advertise pseudo/directcolor
605 * visuals if it can't deal with the palette.
606 */
607 if (WARN_ON(!fb_helper->funcs->gamma_set ||
608 !fb_helper->funcs->gamma_get))
609 return -EINVAL;
610
600 pindex = regno; 611 pindex = regno;
601 612
602 if (fb->bits_per_pixel == 16) { 613 if (fb->bits_per_pixel == 16) {
@@ -677,7 +688,8 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
677 if (rc) 688 if (rc)
678 goto out; 689 goto out;
679 } 690 }
680 crtc_funcs->load_lut(crtc); 691 if (crtc_funcs->load_lut)
692 crtc_funcs->load_lut(crtc);
681 } 693 }
682 out: 694 out:
683 drm_modeset_unlock_all(dev); 695 drm_modeset_unlock_all(dev);