[RESEND PATCH 06/28] drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl()

Boris Brezillon boris.brezillon at free-electrons.com
Tue Dec 15 03:20:54 PST 2015


From: Rasmus Villemoes <linux at rasmusvillemoes.dk>

Signed-off-by: Rasmus Villemoes <linux at rasmusvillemoes.dk>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7d620e8..a3ae985 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -815,11 +815,8 @@ 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 {
+		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_no_copy;
-- 
2.1.4



More information about the dri-devel mailing list