staging: rtl8188eu: os_dep: Replaced kzalloc and memcpy with kmemdup

Replaced calls to kzalloc followed by memcpy with a single call to
kmemdup.

Patch found using coccicheck.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Tapasweni Pathak 2014-10-21 09:48:20 +05:30 committed by Greg Kroah-Hartman
parent b312fb06b5
commit 705515cdcd

View file

@ -512,14 +512,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
} }
if (ielen) { if (ielen) {
buf = kzalloc(ielen, GFP_KERNEL); buf = kmemdup(pie, ielen, GFP_KERNEL);
if (buf == NULL) { if (buf == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto exit; goto exit;
} }
memcpy(buf, pie, ielen);
/* dump */ /* dump */
{ {
int i; int i;