Commit 7da54927 authored by Colin Ian King's avatar Colin Ian King Committed by Patrik Jakobsson

drm/gma500: fix null dereference of pointer fb before null check

Pointer fb is being dereferenced when assigning dev before it
is null checked.  Fix this by only dereferencing dev after the
null check.

Fixes: 6b7ce2c4 ("drm/gma500: Remove struct psb_fbdev")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191216162136.270114-1-colin.king@canonical.com
parent 24f03be4
...@@ -228,8 +228,8 @@ static void psbfb_copyarea_accel(struct fb_info *info, ...@@ -228,8 +228,8 @@ static void psbfb_copyarea_accel(struct fb_info *info,
{ {
struct drm_fb_helper *fb_helper = info->par; struct drm_fb_helper *fb_helper = info->par;
struct drm_framebuffer *fb = fb_helper->fb; struct drm_framebuffer *fb = fb_helper->fb;
struct drm_device *dev = fb->dev; struct drm_device *dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv;
uint32_t offset; uint32_t offset;
uint32_t stride; uint32_t stride;
uint32_t src_format; uint32_t src_format;
...@@ -238,6 +238,8 @@ static void psbfb_copyarea_accel(struct fb_info *info, ...@@ -238,6 +238,8 @@ static void psbfb_copyarea_accel(struct fb_info *info,
if (!fb) if (!fb)
return; return;
dev = fb->dev;
dev_priv = dev->dev_private;
offset = to_gtt_range(fb->obj[0])->offset; offset = to_gtt_range(fb->obj[0])->offset;
stride = fb->pitches[0]; stride = fb->pitches[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment