summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tiny/simpledrm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/tiny/simpledrm.c')
-rw-r--r--drivers/gpu/drm/tiny/simpledrm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index ea5b3239a659..51d01e34d5eb 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -687,8 +687,11 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
drm_err(dev, "no simplefb configuration found\n");
return ERR_PTR(-ENODEV);
}
- if (!stride)
- stride = DIV_ROUND_UP(drm_format_info_bpp(format, 0) * width, 8);
+ if (!stride) {
+ stride = drm_format_info_min_pitch(format, 0, width);
+ if (drm_WARN_ON(dev, !stride))
+ return ERR_PTR(-EINVAL);
+ }
sdev->mode = simpledrm_mode(width, height);
sdev->format = format;