All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging/omapdrm: Use kmemdup rather than duplicating its implementation
@ 2013-01-25 23:40 Peter Huewe
  2013-01-29 15:24 ` Rob Clark
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Huewe @ 2013-01-25 23:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rob Clark, Andy Gross, YAMANE Toshiaki, Vincent Penquerc'h,
	devel, linux-kernel, Peter Huewe

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>
---
 drivers/staging/omapdrm/omap_gem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c
index 08f1e292..f9297eb 100644
--- a/drivers/staging/omapdrm/omap_gem.c
+++ b/drivers/staging/omapdrm/omap_gem.c
@@ -1267,12 +1267,12 @@ int omap_gem_set_sync_object(struct drm_gem_object *obj, void *syncobj)
 
 	if ((omap_obj->flags & OMAP_BO_EXT_SYNC) && !syncobj) {
 		/* clearing a previously set syncobj */
-		syncobj = kzalloc(sizeof(*omap_obj->sync), GFP_ATOMIC);
+		syncobj = kmemdup(omap_obj->sync, sizeof(*omap_obj->sync),
+				  GFP_ATOMIC);
 		if (!syncobj) {
 			ret = -ENOMEM;
 			goto unlock;
 		}
-		memcpy(syncobj, omap_obj->sync, sizeof(*omap_obj->sync));
 		omap_obj->flags &= ~OMAP_BO_EXT_SYNC;
 		omap_obj->sync = syncobj;
 	} else if (syncobj && !(omap_obj->flags & OMAP_BO_EXT_SYNC)) {
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-29 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-25 23:40 [PATCH] staging/omapdrm: Use kmemdup rather than duplicating its implementation Peter Huewe
2013-01-29 15:24 ` Rob Clark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.