From patchwork Fri Aug 7 07:59:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 6966131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 64038C05AC for ; Fri, 7 Aug 2015 08:03:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9D2E4204D9 for ; Fri, 7 Aug 2015 08:03:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C21252041D for ; Fri, 7 Aug 2015 08:03:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNcaS-0005dg-RR; Fri, 07 Aug 2015 08:01:08 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNcaO-0005Wx-Ue for linux-arm-kernel@lists.infradead.org; Fri, 07 Aug 2015 08:01:05 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSP00KDBCX23840@mailout4.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 07 Aug 2015 09:00:38 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-85-55c465a5ad21 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 23.94.04846.5A564C55; Fri, 7 Aug 2015 09:00:37 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NSP0013BCW67E10@eusync2.samsung.com>; Fri, 07 Aug 2015 09:00:37 +0100 (BST) From: Andrzej Hajda To: Derek Chickles , Satanand Burla , Felix Manlunas , Raghu Vatsavayi , Sunil Goutham , Robert Richter Subject: [PATCH 16/31] net/cavium/liquidio: use kmemdup rather than duplicating its implementation Date: Fri, 07 Aug 2015 09:59:22 +0200 Message-id: <1438934377-4922-17-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> References: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrILMWRmVeSWpSXmKPExsVy+t/xK7pLU4+EGjzs17a4te4cq8XGGetZ LRZ9+MhssbTxF7vFpsfXWC0u75rDZrH2yF12i2MLxCyubD3OYnFw1UYmiy/b97NZXL78g9mB x2PG70UsHhtO9LN6bFrVyeaxeUm9R9+WVYwenzfJBbBFcdmkpOZklqUW6dslcGXc2LSDuWAp R8Xpd1PYGhgnsncxcnJICJhIHH75GMoWk7hwbz1bFyMXh5DAUkaJfxf/QjlNTBIfdp5mAqli E9CU+Lv5JlhCRGAJk8TDn8dZQBxmgTeMEnunnwByODiEBVIk/vYqgjSwCKhKLNr6EayZV8BZ YubxY6wQ6+QkTh6bDGZzAsVXds8Es4UEnCTe9F1gnsDIu4CRYRWjaGppckFxUnquoV5xYm5x aV66XnJ+7iZGSEB+2cG4+JjVIUYBDkYlHt6Ef4dDhVgTy4orcw8xSnAwK4nwPtQHCvGmJFZW pRblxxeV5qQWH2KU5mBREuedu+t9iJBAemJJanZqakFqEUyWiYNTqoGxdanJr5DMqtevbpYk KP6N/NY3QzTIosXs6uGcK3vO2l1Pzl88c5rVhb8ZyttDGMR78kWjH2XPa7Ys2HT/gH7cwQ9V bKc7Qo8qmHT6NX2TDp7wa6W4YbKhuaHCkn0qR63l152t++Dg0xjBb+3RlV71Sb/wcnDVDL1d LroG1kYtR93bmXde1lFiKc5INNRiLipOBAAUwwD0RAIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150807_010105_158970_828033C5 X-CRM114-Status: GOOD ( 10.92 ) X-Spam-Score: -7.0 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrzej Hajda , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda --- drivers/net/ethernet/cavium/liquidio/octeon_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c index f67641a..8e23e3f 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c @@ -602,12 +602,10 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data, snprintf(oct->fw_info.liquidio_firmware_version, 32, "LIQUIDIO: %s", h->version); - buffer = kmalloc(size, GFP_KERNEL); + buffer = kmemdup(data, size, GFP_KERNEL); if (!buffer) return -ENOMEM; - memcpy(buffer, data, size); - p = buffer + sizeof(struct octeon_firmware_file_header); /* load all images */