diff options
author | zhong jiang <zhongjiang@huawei.com> | 2018-09-18 11:25:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-12-03 13:27:17 -0500 |
commit | 73f847af391ad51b712b736de8a04bed77213fd9 (patch) | |
tree | 244322a3be594a6d0fb2de5575ca6f3e5a89b3ee /drivers/media/usb/dvb-usb-v2 | |
parent | 458ffce1cb46e46e3cec48b625ed142250475708 (diff) | |
download | linux-stable-73f847af391ad51b712b736de8a04bed77213fd9.tar.gz linux-stable-73f847af391ad51b712b736de8a04bed77213fd9.tar.bz2 linux-stable-73f847af391ad51b712b736de8a04bed77213fd9.zip |
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>
Diffstat (limited to 'drivers/media/usb/dvb-usb-v2')
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/gl861.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/gl861.c b/drivers/media/usb/dvb-usb-v2/gl861.c index 0559417c8af4..80fed4494736 100644 --- a/drivers/media/usb/dvb-usb-v2/gl861.c +++ b/drivers/media/usb/dvb-usb-v2/gl861.c @@ -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); |