ASoC: q6core: Use kmemdup to replace kzalloc + memcpy

kmemdup has implemented the function that kzalloc() + memcpy() will
do. and we prefer to use the kmemdup rather than the open coded implementation.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
zhong jiang 2018-09-08 16:36:19 +08:00 коммит произвёл Mark Brown
Родитель fb77436a44
Коммит 18fbe800e6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
1 изменённых файлов: 2 добавлений и 6 удалений

Просмотреть файл

@ -105,12 +105,10 @@ static int q6core_callback(struct apr_device *adev, struct apr_resp_pkt *data)
bytes = sizeof(*fwk) + fwk->num_services *
sizeof(fwk->svc_api_info[0]);
core->fwk_version = kzalloc(bytes, GFP_ATOMIC);
core->fwk_version = kmemdup(data->payload, bytes, GFP_ATOMIC);
if (!core->fwk_version)
return -ENOMEM;
memcpy(core->fwk_version, data->payload, bytes);
core->fwk_version_supported = true;
core->resp_received = true;
@ -124,12 +122,10 @@ static int q6core_callback(struct apr_device *adev, struct apr_resp_pkt *data)
len = sizeof(*v) + v->num_services * sizeof(v->svc_api_info[0]);
core->svc_version = kzalloc(len, GFP_ATOMIC);
core->svc_version = kmemdup(data->payload, len, GFP_ATOMIC);
if (!core->svc_version)
return -ENOMEM;
memcpy(core->svc_version, data->payload, len);
core->get_version_supported = true;
core->resp_received = true;