From patchwork Mon Sep 5 20:38:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luka Perkov X-Patchwork-Id: 113441 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 1DFEAB6F7E for ; Tue, 6 Sep 2011 06:39:06 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 717A128082; Mon, 5 Sep 2011 22:39:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 Q5h8Y4D9nlZN; Mon, 5 Sep 2011 22:39:03 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6A10D28085; Mon, 5 Sep 2011 22:39:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 28F5D28085 for ; Mon, 5 Sep 2011 22:39:00 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 z-7l75XDaZiq for ; Mon, 5 Sep 2011 22:38:59 +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 mail-ew0-f44.google.com (mail-ew0-f44.google.com [209.85.215.44]) by theia.denx.de (Postfix) with ESMTPS id 252EE28082 for ; Mon, 5 Sep 2011 22:38:57 +0200 (CEST) Received: by ewy19 with SMTP id 19so3090860ewy.3 for ; Mon, 05 Sep 2011 13:38:54 -0700 (PDT) Received: by 10.14.5.140 with SMTP id 12mr553121eel.182.1315255133846; Mon, 05 Sep 2011 13:38:53 -0700 (PDT) Received: from localhost (iskon6395.duo.carnet.hr [31.147.120.251]) by mx.google.com with ESMTPS id e4sm11450352eec.10.2011.09.05.13.38.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Sep 2011 13:38:52 -0700 (PDT) Date: Mon, 5 Sep 2011 22:38:48 +0200 From: Luka Perkov To: u-boot@lists.denx.de Message-ID: <20110905203848.GA12498@w500.gigaset.lan> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [U-Boot] [PATCH] minor improvements for env tools X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Patch from openwrt commit r20062 regarding erase_len. Correct types inside two fprintf functions. Signed-off-by: Luka Perkov < lists ->-to->- lukaperkov.net > diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index ed6b53f..4e4f6aa 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -488,7 +488,7 @@ int fw_setenv(int argc, char *argv[]) value = (char *)malloc(len - strlen(name)); if (!value) { fprintf(stderr, - "Cannot malloc %u bytes: %s\n", + "Cannot malloc %zu bytes: %s\n", len - strlen(name), strerror(errno)); return -1; } @@ -779,7 +779,10 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count, erase_offset = (offset / blocklen) * blocklen; /* Maximum area we may use */ - erase_len = top_of_range - erase_offset; + if (mtd_type == MTD_NANDFLASH) + erase_len = top_of_range - erase_offset; + else + erase_len = blocklen; blockstart = erase_offset; /* Offset inside a block */ @@ -802,7 +805,7 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count, data = malloc (erase_len); if (!data) { fprintf (stderr, - "Cannot malloc %u bytes: %s\n", + "Cannot malloc %zu bytes: %s\n", erase_len, strerror (errno)); return -1; }