aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c7
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_drv.c3
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c6
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c5
-rw-r--r--drivers/gpu/drm/udl/udl_fb.c9
5 files changed, 22 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index c0530a1af5e3..2dc5e8bed172 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -461,6 +461,12 @@ int drm_mode_getfb(struct drm_device *dev,
461 if (!fb) 461 if (!fb)
462 return -ENOENT; 462 return -ENOENT;
463 463
464 /* Multi-planar framebuffers need getfb2. */
465 if (fb->format->num_planes > 1) {
466 ret = -EINVAL;
467 goto out;
468 }
469
464 r->height = fb->height; 470 r->height = fb->height;
465 r->width = fb->width; 471 r->width = fb->width;
466 r->depth = fb->format->depth; 472 r->depth = fb->format->depth;
@@ -484,6 +490,7 @@ int drm_mode_getfb(struct drm_device *dev,
484 ret = -ENODEV; 490 ret = -ENODEV;
485 } 491 }
486 492
493out:
487 drm_framebuffer_put(fb); 494 drm_framebuffer_put(fb);
488 495
489 return ret; 496 return ret;
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 4570da0227b4..d9a71f361b14 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -111,7 +111,7 @@ static int sun4i_drv_bind(struct device *dev)
111 /* drm_vblank_init calls kcalloc, which can fail */ 111 /* drm_vblank_init calls kcalloc, which can fail */
112 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); 112 ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
113 if (ret) 113 if (ret)
114 goto free_mem_region; 114 goto cleanup_mode_config;
115 115
116 drm->irq_enabled = true; 116 drm->irq_enabled = true;
117 117
@@ -139,7 +139,6 @@ finish_poll:
139 sun4i_framebuffer_free(drm); 139 sun4i_framebuffer_free(drm);
140cleanup_mode_config: 140cleanup_mode_config:
141 drm_mode_config_cleanup(drm); 141 drm_mode_config_cleanup(drm);
142free_mem_region:
143 of_reserved_mem_device_release(dev); 142 of_reserved_mem_device_release(dev);
144free_drm: 143free_drm:
145 drm_dev_unref(drm); 144 drm_dev_unref(drm);
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index 500b6fb3e028..fa4bcd092eaf 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -538,7 +538,8 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
538 &sun4i_hdmi_regmap_config); 538 &sun4i_hdmi_regmap_config);
539 if (IS_ERR(hdmi->regmap)) { 539 if (IS_ERR(hdmi->regmap)) {
540 dev_err(dev, "Couldn't create HDMI encoder regmap\n"); 540 dev_err(dev, "Couldn't create HDMI encoder regmap\n");
541 return PTR_ERR(hdmi->regmap); 541 ret = PTR_ERR(hdmi->regmap);
542 goto err_disable_mod_clk;
542 } 543 }
543 544
544 ret = sun4i_tmds_create(hdmi); 545 ret = sun4i_tmds_create(hdmi);
@@ -551,7 +552,8 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
551 hdmi->ddc_parent_clk = devm_clk_get(dev, "ddc"); 552 hdmi->ddc_parent_clk = devm_clk_get(dev, "ddc");
552 if (IS_ERR(hdmi->ddc_parent_clk)) { 553 if (IS_ERR(hdmi->ddc_parent_clk)) {
553 dev_err(dev, "Couldn't get the HDMI DDC clock\n"); 554 dev_err(dev, "Couldn't get the HDMI DDC clock\n");
554 return PTR_ERR(hdmi->ddc_parent_clk); 555 ret = PTR_ERR(hdmi->ddc_parent_clk);
556 goto err_disable_mod_clk;
555 } 557 }
556 } else { 558 } else {
557 hdmi->ddc_parent_clk = hdmi->tmds_clk; 559 hdmi->ddc_parent_clk = hdmi->tmds_clk;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 2de586b7c98b..a818ca491605 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -103,6 +103,7 @@ static void sun4i_tcon_channel_set_status(struct sun4i_tcon *tcon, int channel,
103 103
104 if (enabled) { 104 if (enabled) {
105 clk_prepare_enable(clk); 105 clk_prepare_enable(clk);
106 clk_rate_exclusive_get(clk);
106 } else { 107 } else {
107 clk_rate_exclusive_put(clk); 108 clk_rate_exclusive_put(clk);
108 clk_disable_unprepare(clk); 109 clk_disable_unprepare(clk);
@@ -262,7 +263,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
262 const struct drm_display_mode *mode) 263 const struct drm_display_mode *mode)
263{ 264{
264 /* Configure the dot clock */ 265 /* Configure the dot clock */
265 clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000); 266 clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
266 267
267 /* Set the resolution */ 268 /* Set the resolution */
268 regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG, 269 regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
@@ -423,7 +424,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
423 WARN_ON(!tcon->quirks->has_channel_1); 424 WARN_ON(!tcon->quirks->has_channel_1);
424 425
425 /* Configure the dot clock */ 426 /* Configure the dot clock */
426 clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000); 427 clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
427 428
428 /* Adjust clock delay */ 429 /* Adjust clock delay */
429 clk_delay = sun4i_tcon_get_clk_delay(mode, 1); 430 clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index b5b335c9b2bb..2ebdc6d5a76e 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -159,10 +159,15 @@ static int udl_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
159{ 159{
160 unsigned long start = vma->vm_start; 160 unsigned long start = vma->vm_start;
161 unsigned long size = vma->vm_end - vma->vm_start; 161 unsigned long size = vma->vm_end - vma->vm_start;
162 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 162 unsigned long offset;
163 unsigned long page, pos; 163 unsigned long page, pos;
164 164
165 if (offset + size > info->fix.smem_len) 165 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
166 return -EINVAL;
167
168 offset = vma->vm_pgoff << PAGE_SHIFT;
169
170 if (offset > info->fix.smem_len || size > info->fix.smem_len - offset)
166 return -EINVAL; 171 return -EINVAL;
167 172
168 pos = (unsigned long)info->fix.smem_start + offset; 173 pos = (unsigned long)info->fix.smem_start + offset;