Commit 8524b001 authored by Thomas Meyer's avatar Thomas Meyer Committed by David S. Miller

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: default avatarThomas Meyer <thomas@m3y3r.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent efd0bf97
...@@ -1461,14 +1461,12 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance) ...@@ -1461,14 +1461,12 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
} }
/* Allocate a new instance */ /* Allocate a new instance */
new = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC); new = kmemdup(orig, sizeof(struct tsap_cb), GFP_ATOMIC);
if (!new) { if (!new) {
IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __func__); IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __func__);
spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags); spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags);
return NULL; return NULL;
} }
/* Dup */
memcpy(new, orig, sizeof(struct tsap_cb));
spin_lock_init(&new->lock); spin_lock_init(&new->lock);
/* We don't need the old instance any more */ /* We don't need the old instance any more */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment