Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1689153imm; Wed, 8 Aug 2018 23:48:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxRdpcCuC1fTjrzmGaRJNJ0UuSgI/Ip2HBXl5XAPt0RifmNOqY5GoDOZhu0W2ohNdMbMjDy X-Received: by 2002:a17:902:7247:: with SMTP id c7-v6mr884617pll.79.1533797329277; Wed, 08 Aug 2018 23:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533797329; cv=none; d=google.com; s=arc-20160816; b=ckZU7pwNXak0L1MG+jIEbSRORWnYDVCW9WHxfJXd5PImguPn2yay8AqJpbwwVheGJU mI3uvwMfBa9OOEwP7WTtaKWoMRe4D6v5j3PHK2fJzovrwg9m1VSLOaZ6zpxaLGDQ2xeO 7PuX/K4M5CQ/Z12KZ4ROugVu1BtjLPaGzKFx7NyW1DAa6N7SFXDqdsRHs3Y/2HMNeR62 SHWenoNLa9jU2kU7y6BPs+LS75NccioR3a7P8IKMhfSpaljzoSiDBeTTGgpkGl+yKoBg AbT5GVHGPcPOfFswLFZWatsZ06Roxq+AJTCAHXME77NqZBn4sdEUYqPc1REBqXVGoFQ4 zUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=j0Lv6MErNv6Aj54RecQCZEkgBtcWPKuciyZOka6rNlM=; b=YULoxJtnIobjQ5qyf1bcyRDd80ST8rDOMr1bX9VMOLKz+qFF8KzhmMvlzzhDjMb14n hpjnZ80yxtmVdvHZbG8E5lxQuN4zQQT2VfKEbJPxIKv6BwzT2L0HBfIinpYloH0E5VMN cdq+/PljS37X9JZCWe/bfp8Pc4nQiPXei0qUe1RXm524XvhQW3u+uKQctnrWaCnHbEr+ g+I1TZbUCKQrsS/gXq1l6znWCfqttcOijdeXFzA0GhS8YXmyPb6/kikMWpqn4XTmlpOJ vu3WFZrmPngvoTccE+s0QEN4iWkp3AM9EQMY7GsngH3AgbUG+cZgVk+hq9mkkc3Uuik9 rlcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65-v6si6187416pld.451.2018.08.08.23.48.33; Wed, 08 Aug 2018 23:48:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728578AbeHIJLI (ORCPT + 99 others); Thu, 9 Aug 2018 05:11:08 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59571 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727371AbeHIJLI (ORCPT ); Thu, 9 Aug 2018 05:11:08 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 2A86527530C7F; Thu, 9 Aug 2018 14:47:41 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.399.0; Thu, 9 Aug 2018 14:47:35 +0800 From: YueHaibing To: , , , CC: , , , YueHaibing Subject: [PATCH net-next] ieee802154: Use kmemdup instead of duplicating it in ca8210_test_int_driver_write Date: Thu, 9 Aug 2018 14:44:29 +0800 Message-ID: <20180809064429.13348-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace calls to kmalloc followed by a memcpy with a direct call to kmemdup. Signed-off-by: YueHaibing --- 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); -- 2.7.0