Commit 656271139f804e6e337a3dfe85e29a8f2d65587a
1 parent
2a5e3a2d1f
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
5 other branches
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> (cherry picked from commit 8c9f2dbf90c7908c5df1ac3727e8c177c8809240)
Showing 1 changed file with 15 additions and 12 deletions Side-by-side Diff
arch/arm/mach-imx/imx8/fuse.c
... | ... | @@ -24,13 +24,16 @@ |
24 | 24 | |
25 | 25 | int fuse_sense(u32 bank, u32 word, u32 *val) |
26 | 26 | { |
27 | - if (bank != 0) { | |
28 | - printf("Invalid bank argument, ONLY bank 0 is supported\n"); | |
29 | - return -EINVAL; | |
30 | - } | |
27 | + if (bank != 0) { | |
28 | + printf("Invalid bank argument, ONLY bank 0 is supported\n"); | |
29 | + return -EINVAL; | |
30 | + } | |
31 | 31 | #if defined(CONFIG_SMC_FUSE) |
32 | - return call_imx_sip_ret2(FSL_SIP_OTP_READ, (unsigned long)word,\ | |
33 | - (unsigned long)val, 0, 0); | |
32 | + unsigned long ret, value; | |
33 | + ret = call_imx_sip_ret2(FSL_SIP_OTP_READ, (unsigned long)word, | |
34 | + &value, 0, 0); | |
35 | + *val = (u32)value; | |
36 | + return ret; | |
34 | 37 | #else |
35 | 38 | sc_err_t err; |
36 | 39 | sc_ipc_t ipc; |
37 | 40 | |
... | ... | @@ -49,14 +52,14 @@ |
49 | 52 | |
50 | 53 | int fuse_prog(u32 bank, u32 word, u32 val) |
51 | 54 | { |
52 | - if (bank != 0) { | |
53 | - printf("Invalid bank argument, ONLY bank 0 is supported\n"); | |
54 | - return -EINVAL; | |
55 | - } | |
55 | + if (bank != 0) { | |
56 | + printf("Invalid bank argument, ONLY bank 0 is supported\n"); | |
57 | + return -EINVAL; | |
58 | + } | |
56 | 59 | |
57 | 60 | #if defined(CONFIG_SMC_FUSE) |
58 | - return call_imx_sip(FSL_SIP_OTP_WRITE, (unsigned long)word,\ | |
59 | - (unsigned long)val, 0, 0); | |
61 | + return call_imx_sip(FSL_SIP_OTP_WRITE, (unsigned long)word,\ | |
62 | + (unsigned long)val, 0, 0); | |
60 | 63 | #else |
61 | 64 | printf("Program fuse to i.MX8 in u-boot is forbidden\n"); |
62 | 65 | return -EPERM; |