[Freedreno] [PATCH] drm/msm: don't deref error pointer in the msm_fbdev_create error path
Emil Velikov
emil.l.velikov at gmail.com
Wed Mar 28 15:53:47 UTC 2018
From: Emil Velikov <emil.velikov at collabora.com>
Currently the error pointer returned by msm_alloc_stolen_fb gets passed
to drm_framebuffer_remove. The latter handles only NULL pointers, thus
a nasty crash will occur.
Drop the unnecessary fail label and the associated checks - both err and
fb will be set at this stage.
Cc: Rob Clark <robdclark at gmail.com>
Cc: linux-arm-msm at vger.kernel.org
Cc: dri-devel at lists.freedesktop.org
Cc: freedreno at lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
drivers/gpu/drm/msm/msm_fbdev.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index c178563fcd4d..6ed89bcfedf5 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -92,8 +92,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
if (IS_ERR(fb)) {
dev_err(dev->dev, "failed to allocate fb\n");
- ret = PTR_ERR(fb);
- goto fail;
+ return PTR_ERR(fb);
}
bo = msm_framebuffer_bo(fb, 0);
@@ -153,11 +152,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
mutex_unlock(&dev->struct_mutex);
fail:
- if (ret) {
- if (fb)
- drm_framebuffer_remove(fb);
- }
-
+ drm_framebuffer_remove(fb);
return ret;
}
--
2.16.0
More information about the Freedreno
mailing list