diff options
author | Shyam Saini <mayhs11saini@gmail.com> | 2017-01-19 13:45:34 -0800 |
---|---|---|
committer | Sinclair Yeh <syeh@vmware.com> | 2017-01-26 21:26:17 -0800 |
commit | 5d25fde23b3176c7f94d2a992cb9762707d7c2a0 (patch) | |
tree | 0a2398da4b68335d045d3ebd46145ddfac607eab /drivers/gpu/drm/vmwgfx | |
parent | 8c95742e566f3945f992472a5f99f78aaa7f890b (diff) | |
download | op-kernel-dev-5d25fde23b3176c7f94d2a992cb9762707d7c2a0.zip op-kernel-dev-5d25fde23b3176c7f94d2a992cb9762707d7c2a0.tar.gz |
drm/vmwgfx: Use kmemdup instead of kmalloc and memcpy
When some other buffer is immediately copied into allocated region.
Replace calls to kmalloc followed by a memcpy with a direct
call to kmemdup.
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Reviewed-by: Sinclair Yeh <syeh@vmare.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c index b6126a5..941bcfd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c @@ -319,18 +319,17 @@ int vmw_otables_setup(struct vmw_private *dev_priv) int ret; if (dev_priv->has_dx) { - *otables = kmalloc(sizeof(dx_tables), GFP_KERNEL); + *otables = kmemdup(dx_tables, sizeof(dx_tables), GFP_KERNEL); if (*otables == NULL) return -ENOMEM; - memcpy(*otables, dx_tables, sizeof(dx_tables)); dev_priv->otable_batch.num_otables = ARRAY_SIZE(dx_tables); } else { - *otables = kmalloc(sizeof(pre_dx_tables), GFP_KERNEL); + *otables = kmemdup(pre_dx_tables, sizeof(pre_dx_tables), + GFP_KERNEL); if (*otables == NULL) return -ENOMEM; - memcpy(*otables, pre_dx_tables, sizeof(pre_dx_tables)); dev_priv->otable_batch.num_otables = ARRAY_SIZE(pre_dx_tables); } |