Message ID | 20180906034228.7660-1-yuehaibing@huawei.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [net-next] ieee802154: ca8210: Use kmemdup instead of duplicating it in ca8210_test_int_driver_write | expand |
sorry, Pls ignore this duplicated patch. On 2018/9/6 11:42, YueHaibing wrote: > Replace calls to kmalloc followed by a memcpy with a direct call tokmemdup. > > Patch found using coccinelle. > > Signed-off-by: YueHaibing <yuehaibing@huawei.com> > --- > drivers/net/ieee802154/ca8210.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c > index 58299fb..e21279d 100644 > --- a/drivers/net/ieee802154/ca8210.c > +++ b/drivers/net/ieee802154/ca8210.c > @@ -634,10 +634,9 @@ static int ca8210_test_int_driver_write( > for (i = 0; i < len; i++) > dev_dbg(&priv->spi->dev, "%#03x\n", buf[i]); > > - fifo_buffer = kmalloc(len, GFP_KERNEL); > + fifo_buffer = kmemdup(buf, len, GFP_KERNEL); > if (!fifo_buffer) > return -ENOMEM; > - memcpy(fifo_buffer, buf, len); > kfifo_in(&test->up_fifo, &fifo_buffer, 4); > wake_up_interruptible(&priv->test.readq); > >
diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c index 58299fb..e21279d 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -634,10 +634,9 @@ static int ca8210_test_int_driver_write( for (i = 0; i < len; i++) dev_dbg(&priv->spi->dev, "%#03x\n", buf[i]); - fifo_buffer = kmalloc(len, GFP_KERNEL); + fifo_buffer = kmemdup(buf, len, GFP_KERNEL); if (!fifo_buffer) return -ENOMEM; - memcpy(fifo_buffer, buf, len); kfifo_in(&test->up_fifo, &fifo_buffer, 4); wake_up_interruptible(&priv->test.readq);
Replace calls to kmalloc followed by a memcpy with a direct call tokmemdup. Patch found using coccinelle. Signed-off-by: YueHaibing <yuehaibing@huawei.com> --- drivers/net/ieee802154/ca8210.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)