]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm: Replace kzalloc with kcalloc
authorHarsha Sharma <harshasharmaiitr@gmail.com>
Fri, 13 Oct 2017 07:37:47 +0000 (13:07 +0530)
committerSean Paul <seanpaul@chromium.org>
Fri, 13 Oct 2017 19:49:03 +0000 (15:49 -0400)
Prefer kcalloc over kzalloc to allocate an array.
This patch fixes checkcpatch issue.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013073747.29877-1-harshasharmaiitr@gmail.com
Link: https://patchwork.freedesktop.org/patch/msgid/20171013073747.29877-1-harshasharmaiitr@gmail.com
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_fb_helper.c
drivers/gpu/drm/drm_plane_helper.c

index eab36a4606382dc18bdedf788b526d07a2b462b4..5a84c3bc915df4dd703ccaebc6c98dbde59e8a8b 100644 (file)
@@ -562,12 +562,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
         * Allocate space for the backup of all (non-pointer) encoder and
         * connector data.
         */
-       save_encoder_crtcs = kzalloc(dev->mode_config.num_encoder *
+       save_encoder_crtcs = kcalloc(dev->mode_config.num_encoder,
                                sizeof(struct drm_crtc *), GFP_KERNEL);
        if (!save_encoder_crtcs)
                return -ENOMEM;
 
-       save_connector_encoders = kzalloc(dev->mode_config.num_connector *
+       save_connector_encoders = kcalloc(dev->mode_config.num_connector,
                                sizeof(struct drm_encoder *), GFP_KERNEL);
        if (!save_connector_encoders) {
                kfree(save_encoder_crtcs);
index 6a31d13f2f81deda566074ac75b12618ff9c75ec..116d1f1337c7e36da1622ffc88bfc6e218d461a3 100644 (file)
@@ -2266,7 +2266,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
        if (modes[n] == NULL)
                return best_score;
 
-       crtcs = kzalloc(fb_helper->connector_count *
+       crtcs = kcalloc(fb_helper->connector_count,
                        sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
        if (!crtcs)
                return best_score;
index 06aee1741e96a78f91e582eda88e4c4bc94b3f13..759ed93f4ba8fdf3b8be604f745479ee27838d0b 100644 (file)
@@ -354,7 +354,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
        /* Find current connectors for CRTC */
        num_connectors = get_connectors_for_crtc(crtc, NULL, 0);
        BUG_ON(num_connectors == 0);
-       connector_list = kzalloc(num_connectors * sizeof(*connector_list),
+       connector_list = kcalloc(num_connectors, sizeof(*connector_list),
                                 GFP_KERNEL);
        if (!connector_list)
                return -ENOMEM;