From 656271139f804e6e337a3dfe85e29a8f2d65587a Mon Sep 17 00:00:00 2001 From: Ye Li Date: Fri, 13 Jul 2018 00:48:30 -0700 Subject: [PATCH] MLK-18897 imx8qm/qxp: Fix build warning in fuse driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get such warning below in fuse driver, due to a u32 pointer is converted to ulong then passed as ulong pointer. This is dangerous when assigning value to the memory where ulong pointer points to. So use a intermediate variable to hand over value. Also fix the indenting issue in this patch. arch/arm/cpu/armv8/imx8/fuse.c: In function ‘fuse_sense’: arch/arm/cpu/armv8/imx8/fuse.c:33:25: warning: passing argument 3 of ‘call_imx_sip_ret2’ makes pointer from integer without a cast [-Wint-conversion] (unsigned long)val, 0, 0); ^ In file included from ./arch/arm/include/asm/arch/sys_proto.h:7:0, from arch/arm/cpu/armv8/imx8/fuse.c:13: ./arch/arm/include/asm/imx-common/sys_proto.h:94:15: note: expected ‘long unsigned int *’ but argument is of type ‘long unsigned int’ unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0, unsigned long *reg1, unsigned long reg2, unsigned long reg3); Signed-off-by: Ye Li (cherry picked from commit 8c9f2dbf90c7908c5df1ac3727e8c177c8809240) --- arch/arm/mach-imx/imx8/fuse.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-imx/imx8/fuse.c b/arch/arm/mach-imx/imx8/fuse.c index 6083d38..1194bcf 100644 --- a/arch/arm/mach-imx/imx8/fuse.c +++ b/arch/arm/mach-imx/imx8/fuse.c @@ -24,13 +24,16 @@ int fuse_read(u32 bank, u32 word, u32 *val) int fuse_sense(u32 bank, u32 word, u32 *val) { - if (bank != 0) { - printf("Invalid bank argument, ONLY bank 0 is supported\n"); - return -EINVAL; - } + if (bank != 0) { + printf("Invalid bank argument, ONLY bank 0 is supported\n"); + return -EINVAL; + } #if defined(CONFIG_SMC_FUSE) - return call_imx_sip_ret2(FSL_SIP_OTP_READ, (unsigned long)word,\ - (unsigned long)val, 0, 0); + unsigned long ret, value; + ret = call_imx_sip_ret2(FSL_SIP_OTP_READ, (unsigned long)word, + &value, 0, 0); + *val = (u32)value; + return ret; #else sc_err_t err; sc_ipc_t ipc; @@ -49,14 +52,14 @@ int fuse_sense(u32 bank, u32 word, u32 *val) int fuse_prog(u32 bank, u32 word, u32 val) { - if (bank != 0) { - printf("Invalid bank argument, ONLY bank 0 is supported\n"); - return -EINVAL; - } + if (bank != 0) { + printf("Invalid bank argument, ONLY bank 0 is supported\n"); + return -EINVAL; + } #if defined(CONFIG_SMC_FUSE) - return call_imx_sip(FSL_SIP_OTP_WRITE, (unsigned long)word,\ - (unsigned long)val, 0, 0); + return call_imx_sip(FSL_SIP_OTP_WRITE, (unsigned long)word,\ + (unsigned long)val, 0, 0); #else printf("Program fuse to i.MX8 in u-boot is forbidden\n"); return -EPERM; -- 1.9.1