Skip to content

Commit a4462f2

Browse files
PeterHuewerobclark
authored andcommitted
staging/omapdrm: Use kmemdup rather than duplicating its implementation
Found with coccicheck. The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Rob Clark <rob@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 32ac1a5 commit a4462f2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/staging/omapdrm/omap_gem.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,12 +1267,12 @@ int omap_gem_set_sync_object(struct drm_gem_object *obj, void *syncobj)
12671267

12681268
if ((omap_obj->flags & OMAP_BO_EXT_SYNC) && !syncobj) {
12691269
/* clearing a previously set syncobj */
1270-
syncobj = kzalloc(sizeof(*omap_obj->sync), GFP_ATOMIC);
1270+
syncobj = kmemdup(omap_obj->sync, sizeof(*omap_obj->sync),
1271+
GFP_ATOMIC);
12711272
if (!syncobj) {
12721273
ret = -ENOMEM;
12731274
goto unlock;
12741275
}
1275-
memcpy(syncobj, omap_obj->sync, sizeof(*omap_obj->sync));
12761276
omap_obj->flags &= ~OMAP_BO_EXT_SYNC;
12771277
omap_obj->sync = syncobj;
12781278
} else if (syncobj && !(omap_obj->flags & OMAP_BO_EXT_SYNC)) {

0 commit comments

Comments
 (0)