Commit 10291bff authored by Rob Clark's avatar Rob Clark

drm/msm: bit of fb error checking

It's a problem that can't happen yet, since we don't support any
multi-planar formats yet.  But let's avoid nasty surprises when the
time comes.
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 2638d90a
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
struct msm_framebuffer { struct msm_framebuffer {
struct drm_framebuffer base; struct drm_framebuffer base;
const struct msm_format *format; const struct msm_format *format;
struct drm_gem_object *planes[2]; struct drm_gem_object *planes[3];
}; };
#define to_msm_framebuffer(x) container_of(x, struct msm_framebuffer, base) #define to_msm_framebuffer(x) container_of(x, struct msm_framebuffer, base)
...@@ -202,6 +202,11 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, ...@@ -202,6 +202,11 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
msm_fb->format = format; msm_fb->format = format;
if (n > ARRAY_SIZE(msm_fb->planes)) {
ret = -EINVAL;
goto fail;
}
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
unsigned int width = mode_cmd->width / (i ? hsub : 1); unsigned int width = mode_cmd->width / (i ? hsub : 1);
unsigned int height = mode_cmd->height / (i ? vsub : 1); unsigned int height = mode_cmd->height / (i ? vsub : 1);
......
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