drivers: use kzalloc/kcalloc instead of 'kmalloc+memset', where possible
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / vmwgfx / vmwgfx_resource.c
index 5408b1b7996f054dee95b9ed5aac4e9d63ee99a1..bfe1bcce7f8a3c32ed5e4d2071001f28607a6cbb 100644 (file)
@@ -612,11 +612,9 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
            srf->sizes[0].height == 64 &&
            srf->format == SVGA3D_A8R8G8B8) {
 
-               srf->snooper.image = kmalloc(64 * 64 * 4, GFP_KERNEL);
-               /* clear the image */
-               if (srf->snooper.image) {
-                       memset(srf->snooper.image, 0x00, 64 * 64 * 4);
-               } else {
+               /* allocate image area and clear it */
+               srf->snooper.image = kzalloc(64 * 64 * 4, GFP_KERNEL);
+               if (!srf->snooper.image) {
                        DRM_ERROR("Failed to allocate cursor_image\n");
                        ret = -ENOMEM;
                        goto out_err1;