[PATCH V2 30/30] imx: fsl_sec: preprocessor casting issue with addresses involving math

sbabic at denx.de sbabic at denx.de
Tue Jul 11 21:47:09 CEST 2023


> From: Utkarsh Gupta <utkarsh.gupta at nxp.com>
> The sec_in32 preprocessor is defined as follows in include/fsl_sec.h file:
> When address "a" is calculated using math for ex: addition of base address and
> an offset, then casting is applied only to the first address which in this
> example is base address.
> caam_ccbvid_reg = sec_in32(CONFIG_SYS_FSL_SEC_ADDR + CAAM_CCBVID_OFFSET)
> resolves to:
> caam_ccbvid_reg = in_le32((ulong *)(ulong)CONFIG_SYS_FSL_SEC_ADDR +
>  CAAM_CCBVID_OFFSET)
> instead it should resolve to:
> caam_ccbvid_reg = in_le32((ulong *)(ulong)(CONFIG_SYS_FSL_SEC_ADDR +
>  CAAM_CCBVID_OFFSET))
> Thus add parenthesis around the address "a" so that however the address is
> calculated, the casting is applied to the final calculated address.
> Reviewed-by: Horia Geanta <horia.geanta at nxp.com>
> Reviewed-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Utkarsh Gupta <utkarsh.gupta at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list