Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422774AbbHGIBm (ORCPT ); Fri, 7 Aug 2015 04:01:42 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:23247 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422689AbbHGIAv (ORCPT ); Fri, 7 Aug 2015 04:00:51 -0400 X-AuditID: cbfec7f5-f794b6d000001495-4a-55c465b2be8c From: Andrzej Hajda To: Clemens Ladisch , Jaroslav Kysela Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 29/31] sound/oxfw: use kmemdup rather than duplicating its implementation 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== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1946 Lines: 64 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; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/