From patchwork Fri Aug 7 07:59:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 6968681 Return-Path: X-Original-To: patchwork-alsa-devel@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 BA36AC05AC for ; Fri, 7 Aug 2015 12:09:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9E2E20634 for ; Fri, 7 Aug 2015 12:09:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id AE78C2062D for ; Fri, 7 Aug 2015 12:09:42 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F099B2617B8; Fri, 7 Aug 2015 14:09:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 22A04260513; Fri, 7 Aug 2015 14:08:07 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D33D126042B; Fri, 7 Aug 2015 10:01:03 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by alsa0.perex.cz (Postfix) with ESMTP id 10996260422 for ; Fri, 7 Aug 2015 10:00:57 +0200 (CEST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSP004DYCXEZ440@mailout2.w1.samsung.com> for alsa-devel@alsa-project.org; Fri, 07 Aug 2015 09:00:50 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-4a-55c465b2be8c Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 1B.19.05269.2B564C55; Fri, 7 Aug 2015 09:00:50 +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:50 +0100 (BST) From: Andrzej Hajda To: Clemens Ladisch , Jaroslav Kysela Date: Fri, 07 Aug 2015 09:59:35 +0200 Message-id: <1438934377-4922-30-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+NgFprCLMWRmVeSWpSXmKPExsVy+t/xK7qbUo+EGnyeIm1xa905VosrFw8x WWycsZ7VYsmJh0wWl3fNYbNYe+Quu0Xnrn5WB3aPDZ+b2Dx+rOhn9tj3dhmbR9+WVYwenzfJ BbBGcdmkpOZklqUW6dslcGVMfnOJqeABb8WtbU+YGhhbuLsYOTgkBEwktq8z6WLkBDLFJC7c W8/WxcjFISSwlFHi+v+LjBBOE5PE5qMr2ECq2AQ0Jf5uvglmiwh4STSc3s0MUsQscJpRomvp KSaQhLBAtETzp8lgRSwCqhKvD05iB7F5BZwl/j+awwqxTk7i5LHJYDYnUHxl90wwW0jASeJN 3wXmCYy8CxgZVjGKppYmFxQnpeca6RUn5haX5qXrJefnbmKEhNXXHYxLj1kdYhTgYFTi4U34 dzhUiDWxrLgy9xCjBAezkgjvQ32gEG9KYmVValF+fFFpTmrxIUZpDhYlcd6Zu96HCAmkJ5ak ZqemFqQWwWSZODilGhi3TDl7/umKaeeV/+6rWn8vs+eq2Jmz3nYMtVs2nJKQ7eZf/llpw9sz q0u3R/saOu3+WZTjkt6Z310V3+OQslXw1OG2xe93u5p+6nRf3aakuCS/0ehidn+G8aTtXMv0 4lWnpZ35f6TB8WPbVokjulzV8e4mbE4FVZNF96VdEjlrWdKosIpdr02JpTgj0VCLuag4EQCe C0MjJwIAAA== X-Mailman-Approved-At: Fri, 07 Aug 2015 14:08:03 +0200 Cc: Andrzej Hajda , alsa-devel@alsa-project.org, Marek Szyprowski , linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz Subject: [alsa-devel] [PATCH 29/31] sound/oxfw: use kmemdup rather than duplicating its implementation X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.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 --- sound/firewire/oxfw/oxfw-stream.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c index 873d40f..77ad5b9 100644 --- a/sound/firewire/oxfw/oxfw-stream.c +++ b/sound/firewire/oxfw/oxfw-stream.c @@ -512,12 +512,11 @@ assume_stream_formats(struct snd_oxfw *oxfw, enum avc_general_plug_dir dir, if (err < 0) goto end; - formats[eid] = kmalloc(*len, GFP_KERNEL); + formats[eid] = kmemdup(buf, *len, GFP_KERNEL); if (formats[eid] == NULL) { err = -ENOMEM; goto end; } - memcpy(formats[eid], buf, *len); /* apply the format for each available sampling rate */ for (i = 0; i < ARRAY_SIZE(oxfw_rate_table); i++) { @@ -531,12 +530,11 @@ assume_stream_formats(struct snd_oxfw *oxfw, enum avc_general_plug_dir dir, continue; eid++; - formats[eid] = kmalloc(*len, GFP_KERNEL); + formats[eid] = kmemdup(buf, *len, GFP_KERNEL); if (formats[eid] == NULL) { err = -ENOMEM; goto end; } - memcpy(formats[eid], buf, *len); formats[eid][2] = avc_stream_rate_table[i]; } @@ -594,12 +592,11 @@ static int fill_stream_formats(struct snd_oxfw *oxfw, if (err < 0) break; - formats[eid] = kmalloc(len, GFP_KERNEL); + formats[eid] = kmemdup(buf, len, GFP_KERNEL); if (formats[eid] == NULL) { err = -ENOMEM; break; } - memcpy(formats[eid], buf, len); /* get next entry */ len = AVC_GENERIC_FRAME_MAXIMUM_BYTES;