From patchwork Wed Aug 31 20:00:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 112671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A832CB6F77 for ; Thu, 1 Sep 2011 06:03:03 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qyqzb-0003g9-F4; Wed, 31 Aug 2011 20:02:35 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qyqzb-0006Zc-0F; Wed, 31 Aug 2011 20:02:35 +0000 Received: from mms3.broadcom.com ([216.31.210.19]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QyqzR-0006Xz-Mq for linux-mtd@lists.infradead.org; Wed, 31 Aug 2011 20:02:26 +0000 Received: from [10.9.200.133] by MMS3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Wed, 31 Aug 2011 13:07:50 -0700 X-Server-Uuid: B55A25B1-5D7D-41F8-BC53-C57E7AD3C201 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB02.corp.ad.broadcom.com (10.9.200.133) with Microsoft SMTP Server id 8.2.247.2; Wed, 31 Aug 2011 13:01:58 -0700 Received: from ld-irv-0074.broadcom.com (ld-irv-0074 [10.12.160.50]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 565D174D06; Wed, 31 Aug 2011 13:02:18 -0700 (PDT) From: "Brian Norris" To: "Artem Bityutskiy" Subject: [PATCH 03/10] nandwrite: consolidate buffer usage Date: Wed, 31 Aug 2011 13:00:32 -0700 Message-ID: <1314820839-7107-4-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1314820839-7107-1-git-send-email-computersforpeace@gmail.com> References: <1314820839-7107-1-git-send-email-computersforpeace@gmail.com> MIME-Version: 1.0 X-WSS-ID: 62404B1C3KO11957496-01-01 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110831_160225_976141_2249CFBA X-CRM114-Status: GOOD ( 10.21 ) X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [216.31.210.19 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 1.2 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: b35362@freescale.com, Brian Norris , linux-mtd@lists.infradead.org, Mike Frysinger X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Instead of using two different output buffers for OOB data, let's just use the same one for all output. This adds an extra memcpy, but it simplifies some future work, so it's worth it. Signed-off-by: Brian Norris --- nandwrite.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nandwrite.c b/nandwrite.c index 3f70cb3..3eea6e2 100644 --- a/nandwrite.c +++ b/nandwrite.c @@ -531,11 +531,12 @@ int main(int argc, char * const argv[]) oobreadbuf + start, len); } + } else { + memcpy(oobbuf, oobreadbuf, mtd.oob_size); } /* Write OOB data first, as ecc will be placed in there */ if (mtd_write_oob(mtd_desc, &mtd, fd, mtdoffset, - mtd.oob_size, - noecc ? oobreadbuf : oobbuf)) { + mtd.oob_size, oobbuf)) { sys_errmsg("%s: MTD writeoob failure", mtd_device); goto closeall; }