From patchwork Fri Jan 25 23:23:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Huewe X-Patchwork-Id: 2048351 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1EAB53FD1A for ; Fri, 25 Jan 2013 23:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753587Ab3AYXUO (ORCPT ); Fri, 25 Jan 2013 18:20:14 -0500 Received: from mout.gmx.net ([212.227.15.18]:60713 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753464Ab3AYXUN (ORCPT ); Fri, 25 Jan 2013 18:20:13 -0500 Received: from mailout-de.gmx.net ([10.1.76.30]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MPb5D-1U2zAg2u13-004mzn for ; Sat, 26 Jan 2013 00:20:11 +0100 Received: (qmail invoked by alias); 25 Jan 2013 23:20:11 -0000 Received: from dslb-084-056-054-055.pools.arcor-ip.net (EHLO localhost.localdomain) [84.56.54.55] by mail.gmx.net (mp030) with SMTP; 26 Jan 2013 00:20:11 +0100 X-Authenticated: #12255092 X-Provags-ID: V01U2FsdGVkX19DcItGRklDDEW6x+3mic1ciYl4bEm+xolhUDvu9x NmT763ocJjwixq From: Peter Huewe To: Mauro Carvalho Chehab Cc: Greg Kroah-Hartman , Volokh Konstantin , Peter Huewe , David Howells , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging/media/go7007: Use kmemdup rather than duplicating its implementation Date: Sat, 26 Jan 2013 00:23:30 +0100 Message-Id: <1359156210-4482-1-git-send-email-peterhuewe@gmx.de> X-Mailer: git-send-email 1.7.8.6 X-Y-GMX-Trusted: 0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with coccicheck. The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Peter Huewe --- drivers/staging/media/go7007/go7007-driver.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c index ece2dd1..0e299f0 100644 --- a/drivers/staging/media/go7007/go7007-driver.c +++ b/drivers/staging/media/go7007/go7007-driver.c @@ -108,14 +108,13 @@ static int go7007_load_encoder(struct go7007 *go) return -1; } fw_len = fw_entry->size - 16; - bounce = kmalloc(fw_len, GFP_KERNEL); + bounce = kmemdup(fw_entry->data + 16, fw_len, GFP_KERNEL); if (bounce == NULL) { v4l2_err(go, "unable to allocate %d bytes for " "firmware transfer\n", fw_len); release_firmware(fw_entry); return -1; } - memcpy(bounce, fw_entry->data + 16, fw_len); release_firmware(fw_entry); if (go7007_interface_reset(go) < 0 || go7007_send_firmware(go, bounce, fw_len) < 0 ||