From: David Herrmann Date: Mon, 20 Jan 2014 18:54:18 +0000 (+0100) Subject: drm/udl: fix Bpp calculation in dumb_create() X-Git-Tag: firefly_0821_release~176^2~4105^2~52^2~6 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2b932d8ef009f37d397c211b1dc5d0b056f6ef64;p=firefly-linux-kernel-4.4.55.git drm/udl: fix Bpp calculation in dumb_create() Probably a typo.. we obviously need "(bpp + 7) / 8" instead of "(bpp + 1) / 8". Unlikely to be hit in any sane code, but lets be safe. Use DIV_ROUND_UP() to avoid the problem entirely and make the core more readable. Reviewed-by: Daniel Vetter Signed-off-by: David Herrmann --- diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 8d67b943ac05..be4fcd0f0e0f 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c @@ -60,7 +60,7 @@ int udl_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { - args->pitch = args->width * ((args->bpp + 1) / 8); + args->pitch = args->width * DIV_ROUND_UP(args->bpp, 8); args->size = args->pitch * args->height; return udl_gem_create(file, dev, args->size, &args->handle);