From e9b88faeff90730ed12cd3ce371202694e4ed963 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Mon, 23 Mar 2020 09:05:39 +0100 Subject: [PATCH] cmd/nfsdown: fix recently introduced type mismatch issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When u-boot is configured from odroid-xu3_defconfig, the compiler reports following warnings: In file included from include/config.h:5:0, from include/common.h:23, from cmd/nfsdown.c:11: cmd/nfsdown.c: In function ‘do_nfs_down’: include/configs/odroid_xu3.h:16:32: warning: passing argument 1 of ‘do_nfs_to_fat’ makes pointer from integer without a cast [-Wint-conversion] #define CONFIG_SYS_SDRAM_BASE 0x40000000 ^ cmd/nfsdown.c:24:27: note: in expansion of macro ‘CONFIG_SYS_SDRAM_BASE’ #define NFS_DOWNLOAD_ADDR CONFIG_SYS_SDRAM_BASE ^~~~~~~~~~~~~~~~~~~~~ cmd/nfsdown.c:429:25: note: in expansion of macro ‘NFS_DOWNLOAD_ADDR’ size = do_nfs_to_fat(NFS_DOWNLOAD_ADDR, src_path, ^~~~~~~~~~~~~~~~~ cmd/nfsdown.c:328:12: note: expected ‘void *’ but argument is of type ‘int’ static int do_nfs_to_fat(void *addr, char *file_path, char *file_name, ^~~~~~~~~~~~~ In file included from include/config.h:5:0, from include/common.h:23, from cmd/nfsdown.c:11: include/configs/odroid_xu3.h:16:32: warning: passing argument 2 of ‘do_nfs_to_mmc’ makes pointer from integer without a cast [-Wint-conversion] #define CONFIG_SYS_SDRAM_BASE 0x40000000 ^ cmd/nfsdown.c:24:27: note: in expansion of macro ‘CONFIG_SYS_SDRAM_BASE’ #define NFS_DOWNLOAD_ADDR CONFIG_SYS_SDRAM_BASE ^~~~~~~~~~~~~~~~~~~~~ cmd/nfsdown.c:433:30: note: in expansion of macro ‘NFS_DOWNLOAD_ADDR’ size = do_nfs_to_mmc(mmc, NFS_DOWNLOAD_ADDR, src_path, ^~~~~~~~~~~~~~~~~ cmd/nfsdown.c:282:12: note: expected ‘void *’ but argument is of type ‘int’ static int do_nfs_to_mmc(struct mmc *mmc, void *addr, char *file_path, ^~~~~~~~~~~~~ Fix this by changing addr to unsigned long and adding needed casts. Signed-off-by: Marek Szyprowski Change-Id: Ia78da10d04a0daf3301ddc6fa4c7b73000d33c22 --- cmd/nfsdown.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/nfsdown.c b/cmd/nfsdown.c index a56bae6..d3cde78 100644 --- a/cmd/nfsdown.c +++ b/cmd/nfsdown.c @@ -279,7 +279,7 @@ struct img_comp *create_img_comp(const char *name, uint size) * @param blk_size MMC block size * @return file_size written file size, return -1 if error occurs */ -static int do_nfs_to_mmc(struct mmc *mmc, void *addr, char *file_path, +static int do_nfs_to_mmc(struct mmc *mmc, unsigned long addr, char *file_path, uint part, uint offset, uint size, uint blk_size) { uint _size; @@ -311,7 +311,8 @@ static int do_nfs_to_mmc(struct mmc *mmc, void *addr, char *file_path, ret = mmc->block_dev.block_write(&mmc->block_dev, offset, _size, addr); #else - ret = blk_dwrite(mmc_get_blk_desc(mmc), offset, _size, addr); + ret = blk_dwrite(mmc_get_blk_desc(mmc), offset, _size, + (void *)addr); #endif if (ret != _size) { printk("Failed to write MMC: part(%d), start(%d), size(%d)", @@ -325,7 +326,7 @@ static int do_nfs_to_mmc(struct mmc *mmc, void *addr, char *file_path, return (int)done; } -static int do_nfs_to_fat(void *addr, char *file_path, char *file_name, +static int do_nfs_to_fat(unsigned long addr, char *file_path, char *file_name, uint dev, uint part) { uint _size; @@ -339,7 +340,7 @@ static int do_nfs_to_fat(void *addr, char *file_path, char *file_name, } _size = net_boot_file_size; - snprintf(buf, 256, "fatwrite mmc %d:%d %p %s %x", dev, part, addr, + snprintf(buf, 256, "fatwrite mmc %d:%d %lx %s %x", dev, part, addr, file_name, _size); run_command(buf, 0); -- 2.7.4