ddr: altera: n5x: Ensure correct size of result for correct type casting
PATCH 1/1 ddr: altera: n5x: Ensure correct size of result for correct type casting
From: Tien Fong Chee <[email protected]>
Klockwork reported there is potential value overflow with incorrect typecast, but this is not valid in this arithmetic implementation because result is never over 32-bit size. The code is improved to ensure correct size of result returned with correct type casting for the sake of good coding practice.
Signed-off-by Tien Fong Chee <[email protected]>
Signed-off-by Jit Loon Lim <[email protected]>
--- drivers/ddr/altera/sdram_n5x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/ddr/altera/sdram_n5x.c +4 -4
@@ -2898,9 +2898,9 @@ int sdram_mmr_init_full(struct udevice *dev)* subsystem in complete reset state before init DDR clock * and DDR controller */ - ret =wait_for_bit_le32 ((const void *)((uintptr_t )(readl + ret =wait_for_bit_le32 ((const void *)((uintptr_t )readl (ddr_handoff_info.mem_reset_base) + -MEM_RST_MGR_STATUS )), +MEM_RST_MGR_STATUS ),MEM_RST_MGR_STATUS_RESET_COMPLETE , true,TIMEOUT_200MS , false);if (ret) {
@@ -2923,8 +2923,8 @@ int sdram_mmr_init_full(struct udevice *dev)/* Release the controller from reset */ setbits_le32 ((uintptr_t ) - (readl (ddr_handoff_info.mem_reset_base) + -MEM_RST_MGR_STATUS ),MEM_RST_MGR_STATUS_AXI_RST | +readl (ddr_handoff_info.mem_reset_base) + +MEM_RST_MGR_STATUS ,MEM_RST_MGR_STATUS_AXI_RST |MEM_RST_MGR_STATUS_CONTROLLER_RST |MEM_RST_MGR_STATUS_RESET_COMPLETE );
Signature · 1 line
2.26.2