Commit bd3f0ff9 authored by Thierry Reding's avatar Thierry Reding Committed by Daniel Vetter

drm: Prefer kcalloc() over kzalloc() with multiply

Fixes a couple of checkpatch warnings regarding the use of kzalloc()
with a multiplication. kcalloc() is the preferred API.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4dfd909f
...@@ -1583,7 +1583,7 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr ...@@ -1583,7 +1583,7 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr
total_objects += dev->mode_config.num_encoder; total_objects += dev->mode_config.num_encoder;
total_objects += dev->mode_config.num_bridge; total_objects += dev->mode_config.num_bridge;
group->id_list = kzalloc(total_objects * sizeof(uint32_t), GFP_KERNEL); group->id_list = kcalloc(total_objects, sizeof(uint32_t), GFP_KERNEL);
if (!group->id_list) if (!group->id_list)
return -ENOMEM; return -ENOMEM;
...@@ -3400,7 +3400,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, ...@@ -3400,7 +3400,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
ret = -EINVAL; ret = -EINVAL;
goto out_err1; goto out_err1;
} }
clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); clips = kcalloc(num_clips, sizeof(*clips), GFP_KERNEL);
if (!clips) { if (!clips) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_err1; goto out_err1;
...@@ -3501,7 +3501,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, ...@@ -3501,7 +3501,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
property->dev = dev; property->dev = dev;
if (num_values) { if (num_values) {
property->values = kzalloc(sizeof(uint64_t)*num_values, GFP_KERNEL); property->values = kcalloc(num_values, sizeof(uint64_t),
GFP_KERNEL);
if (!property->values) if (!property->values)
goto fail; goto fail;
} }
...@@ -4468,7 +4469,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, ...@@ -4468,7 +4469,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
{ {
crtc->gamma_size = gamma_size; crtc->gamma_size = gamma_size;
crtc->gamma_store = kzalloc(gamma_size * sizeof(uint16_t) * 3, GFP_KERNEL); crtc->gamma_store = kcalloc(gamma_size, sizeof(uint16_t) * 3,
GFP_KERNEL);
if (!crtc->gamma_store) { if (!crtc->gamma_store) {
crtc->gamma_size = 0; crtc->gamma_size = 0;
return -ENOMEM; return -ENOMEM;
......
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