mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-21 12:41:26 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user