From patchwork Wed Nov 11 16:36:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 542957 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 BEF881402D1 for ; Thu, 12 Nov 2015 03:36:29 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0DA3C4B6F3; Wed, 11 Nov 2015 17:36:26 +0100 (CET) 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 laWxiLG5lo1E; Wed, 11 Nov 2015 17:36:25 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 521894B6CB; Wed, 11 Nov 2015 17:36:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 711944B6CB for ; Wed, 11 Nov 2015 17:36:22 +0100 (CET) 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 y57Lup0GVVaY for ; Wed, 11 Nov 2015 17:36:22 +0100 (CET) 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 mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by theia.denx.de (Postfix) with ESMTPS id 1DE824B6C3 for ; Wed, 11 Nov 2015 17:36:18 +0100 (CET) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id B9FB48E393; Wed, 11 Nov 2015 16:36:16 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-7-136.ams2.redhat.com [10.36.7.136]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tABGaClD014280; Wed, 11 Nov 2015 11:36:14 -0500 From: Hans de Goede To: Tom Rini Date: Wed, 11 Nov 2015 17:36:09 +0100 Message-Id: <1447259769-26997-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] fastboot: mmc: Fix use of 64 bit division 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Directly doing a 64 bit division (when CONFIG_SYS_64BIT_LBA is set) causes linking to fail when building u-boot for ARMv7 with a hard-float tool-chain. This commit fixes this by properly using div_u64 for the division. Note that an alternative fix would be to stop using lbaint_t for blkcnt / blks, since the passed in "download_bytes" is only 32 bits anyways. But we may want to support files / partitions larger then 4G in the near future and using div_u64 is future proof for when download_bytes' type gets changed to a lbaint_t itself. Signed-off-by: Hans de Goede Reviewed-by: Tom Rini --- common/fb_mmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/fb_mmc.c b/common/fb_mmc.c index 0c48cf9..83d66ed 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -11,6 +11,8 @@ #include #include #include +#include +#include #ifndef CONFIG_FASTBOOT_GPT_NAME #define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME @@ -64,7 +66,7 @@ static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info, /* determine number of blocks to write */ blkcnt = ((download_bytes + (info->blksz - 1)) & ~(info->blksz - 1)); - blkcnt = blkcnt / info->blksz; + blkcnt = div_u64(blkcnt, info->blksz); if (blkcnt > info->size) { error("too large for partition: '%s'\n", part_name);