diff options
author | Ye Li <ye.li@nxp.com> | 2018-07-13 00:48:30 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-07-15 18:48:18 -0700 |
commit | 8c9f2dbf90c7908c5df1ac3727e8c177c8809240 (patch) | |
tree | cd20fa0fd7e150659c1cdf44a556930ac61c2c55 | |
parent | 2dd1badb4ed6f2624864183cd076cad90b71a429 (diff) |
MLK-18897 imx8qm/qxp: Fix build warning in fuse driver
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 <ye.li@nxp.com>
-rw-r--r-- | arch/arm/cpu/armv8/imx8/fuse.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/arch/arm/cpu/armv8/imx8/fuse.c b/arch/arm/cpu/armv8/imx8/fuse.c index 195128af7c..a9f77c8692 100644 --- a/arch/arm/cpu/armv8/imx8/fuse.c +++ b/arch/arm/cpu/armv8/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; |