aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-17 07:43:40 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-21 15:02:17 -0500
commit8524b001a21747c7df5c5a8404f0fbf45661ea44 (patch)
tree78d4675486899b9b49c84e968c90f98e28c99f40
parentefd0bf97deeddd9ba53daabfc470a1399c6b0b2d (diff)
irttp: Use kmemdup rather than duplicating its implementation
The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/irda/irttp.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 32e3bb026110..5c93f2952b08 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -1461,14 +1461,12 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
1461 } 1461 }
1462 1462
1463 /* Allocate a new instance */ 1463 /* Allocate a new instance */
1464 new = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC); 1464 new = kmemdup(orig, sizeof(struct tsap_cb), GFP_ATOMIC);
1465 if (!new) { 1465 if (!new) {
1466 IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __func__); 1466 IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __func__);
1467 spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags); 1467 spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags);
1468 return NULL; 1468 return NULL;
1469 } 1469 }
1470 /* Dup */
1471 memcpy(new, orig, sizeof(struct tsap_cb));
1472 spin_lock_init(&new->lock); 1470 spin_lock_init(&new->lock);
1473 1471
1474 /* We don't need the old instance any more */ 1472 /* We don't need the old instance any more */