scst_pres: Introduce kmemdup()

The scst_pr_add_registrant() implementation can be made a little more brief by
using kmemdup() instead of kmalloc() + memcpy().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4610 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-11-09 02:11:59 +00:00
parent 413a68a53e
commit dd4907ea62

View File

@@ -406,13 +406,13 @@ static struct scst_dev_registrant *scst_pr_add_registrant(
goto out;
}
reg->transport_id = kmalloc(tid_size(transport_id), gfp_flags);
reg->transport_id = kmemdup(transport_id, tid_size(transport_id),
gfp_flags);
if (reg->transport_id == NULL) {
PRINT_ERROR("%s", "Unable to allocate initiator port "
"transport id");
goto out_free;
}
memcpy(reg->transport_id, transport_id, tid_size(transport_id));
reg->rel_tgt_id = rel_tgt_id;
reg->key = key;