forked from Minki/linux
media: usb: Use kmemdup instead of duplicating its function.
kmemdup has implemented the function that kmalloc() + memcpy(). We prefer to kmemdup rather than code opened implementation. Signed-off-by: zhong jiang <zhongjiang@huawei.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
458ffce1cb
commit
73f847af39
@ -200,11 +200,10 @@ gl861_i2c_write_ex(struct dvb_usb_device *d, u8 addr, u8 *wbuf, u16 wlen)
|
||||
u8 *buf;
|
||||
int ret;
|
||||
|
||||
buf = kmalloc(wlen, GFP_KERNEL);
|
||||
buf = kmemdup(wbuf, wlen, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(buf, wbuf, wlen);
|
||||
ret = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev, 0),
|
||||
GL861_REQ_I2C_RAW, GL861_WRITE,
|
||||
addr << (8 + 1), 0x0100, buf, wlen, 2000);
|
||||
|
Loading…
Reference in New Issue
Block a user