drivers: use kzalloc/kcalloc instead of 'kmalloc+memset', where possible
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: David Airlie <airlied@linux.ie> Cc: Tejun Heo <tj@kernel.org> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Tento commit je obsažen v:
@@ -585,11 +585,10 @@ int vmw_overlay_init(struct vmw_private *dev_priv)
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
overlay = kmalloc(sizeof(*overlay), GFP_KERNEL);
|
||||
overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
|
||||
if (!overlay)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(overlay, 0, sizeof(*overlay));
|
||||
mutex_init(&overlay->mutex);
|
||||
for (i = 0; i < VMW_MAX_NUM_STREAMS; i++) {
|
||||
overlay->stream[i].buf = NULL;
|
||||
|
@@ -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;
|
||||
|
Odkázat v novém úkolu
Zablokovat Uživatele