From patchwork Fri Sep 14 02:34:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10600263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BE58112B for ; Fri, 14 Sep 2018 02:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 855C12A6D9 for ; Fri, 14 Sep 2018 02:24:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75D942A6BD; Fri, 14 Sep 2018 02:24:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 145442A6BD for ; Fri, 14 Sep 2018 02:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbeINHgu (ORCPT ); Fri, 14 Sep 2018 03:36:50 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:49722 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725953AbeINHgu (ORCPT ); Fri, 14 Sep 2018 03:36:50 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 39D179568C1C; Fri, 14 Sep 2018 10:24:36 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Fri, 14 Sep 2018 10:24:27 +0800 From: YueHaibing To: Antti Palosaari , Mauro Carvalho Chehab CC: YueHaibing , , Subject: [PATCH -next] media: dvb-usb-v2/gl861: Use kmemdup rather than duplicating its implementation in gl861_i2c_write_ex Date: Fri, 14 Sep 2018 02:34:23 +0000 Message-ID: <1536892463-129710-1-git-send-email-yuehaibing@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing --- drivers/media/usb/dvb-usb-v2/gl861.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/gl861.c b/drivers/media/usb/dvb-usb-v2/gl861.c index 0559417..80fed44 100644 --- a/drivers/media/usb/dvb-usb-v2/gl861.c +++ b/drivers/media/usb/dvb-usb-v2/gl861.c @@ -200,11 +200,10 @@ struct friio_config { 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);