From patchwork Thu Jul 26 13:59:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 949703 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=theobroma-systems.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41bv5B2R2Jz9rxx for ; Fri, 27 Jul 2018 00:05:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E5735C21E1A; Thu, 26 Jul 2018 14:01:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A79B0C21C3F; Thu, 26 Jul 2018 14:00:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 25B96C21CB1; Thu, 26 Jul 2018 14:00:16 +0000 (UTC) Received: from mail.theobroma-systems.com (vegas.theobroma-systems.com [144.76.126.164]) by lists.denx.de (Postfix) with ESMTPS id 35AAFC21E08 for ; Thu, 26 Jul 2018 14:00:11 +0000 (UTC) Received: from [86.59.122.178] (port=35020 helo=android.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.80) (envelope-from ) id 1figoL-0006jj-ML; Thu, 26 Jul 2018 16:00:09 +0200 From: Philipp Tomsich To: u-boot@lists.denx.de Date: Thu, 26 Jul 2018 15:59:51 +0200 Message-Id: <1532613591-8444-10-git-send-email-philipp.tomsich@theobroma-systems.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1532613591-8444-1-git-send-email-philipp.tomsich@theobroma-systems.com> References: <1532613591-8444-1-git-send-email-philipp.tomsich@theobroma-systems.com> Cc: Vagrant Cascadian , Carlo Caione , Andy Fleming Subject: [U-Boot] [PATCH 9/9] mpc85xx: add casts for ram size in min() calculation. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" With the change of the ram size fields to u64, we need to use explicit casts to ensure that min()-implementation sees the same type for both its arguments. Signed-off-by: Philipp Tomsich Reviewed-by: York Sun --- arch/powerpc/cpu/mpc85xx/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c index bf48836..5664872 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu.c +++ b/arch/powerpc/cpu/mpc85xx/cpu.c @@ -604,7 +604,8 @@ static int reset_tlb(phys_addr_t p_addr, u32 size, phys_addr_t *phys_offset) int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset) { phys_addr_t test_cap, p_addr; - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED); + phys_size_t p_size = min((phys_size_t)gd->ram_size, + (phys_size_t)CONFIG_MAX_MEM_MAPPED); #if !defined(CONFIG_PHYS_64BIT) || \ !defined(CONFIG_SYS_INIT_RAM_ADDR_PHYS) || \ @@ -632,7 +633,8 @@ int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset) /* initialization for testing area */ int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset) { - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED); + phys_size_t p_size = min((phys_size_t)gd->ram_size, + (phys_size_t)CONFIG_MAX_MEM_MAPPED); *vstart = CONFIG_SYS_DDR_SDRAM_BASE; *size = (u32) p_size; /* CONFIG_MAX_MEM_MAPPED < 4G */