From patchwork Tue Sep 13 05:40:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 672153 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sdbYX4sXDz9sD6 for ; Tue, 20 Sep 2016 18:30:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 367FFA7534; Tue, 20 Sep 2016 10:30:39 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WRwU5BFETmrm; Tue, 20 Sep 2016 10:30:38 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 950144B811; Tue, 20 Sep 2016 10:30:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0A9444B811 for ; Tue, 20 Sep 2016 10:30:37 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R10Uy6CDN6vP for ; Tue, 20 Sep 2016 10:30:36 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by theia.denx.de (Postfix) with ESMTP id CE5944A039 for ; Tue, 20 Sep 2016 10:30:36 +0200 (CEST) Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990864AbcITIagcUM30 (ORCPT ); Tue, 20 Sep 2016 10:30:36 +0200 Resent-Sender: Ladislav Michl Resent-From: Ladislav Michl Resent-Date: Tue, 20 Sep 2016 10:30:34 +0200 Resent-Message-ID: <20160920083034.GB28236@localhost.localdomain> Resent-To: U-Boot Mailing List , Stefan Roese , Kyungmin Park , Tom Rini Date: Tue, 13 Sep 2016 07:40:00 +0200 From: Ladislav Michl To: U-Boot Mailing List Message-ID: <20160913054000.GA1917@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Tom Rini , Stefan Roese , Kyungmin Park Subject: [U-Boot] [PATCH] cmd/onenand.c: block align warning X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" An attempt to write non block aligned data fails silently, add warning and set result. Signed-off-by: Ladislav Michl --- cmd/onenand.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/onenand.c b/cmd/onenand.c index feab01a..090f835 100644 --- a/cmd/onenand.c +++ b/cmd/onenand.c @@ -139,6 +139,12 @@ static int onenand_block_write(loff_t to, size_t len, size_t _retlen = 0; int ret; + if ((to & (mtd->writesize - 1)) != 0) { + printf("Attempt to write non block-aligned data\n"); + *retlen = 0; + return 1; + } + if (to == next_ofs) { next_ofs = to + len; to += skip_ofs;