On 16/10/2026 12:40 pm, Chen Huei Lok wrote:
The *_handoff_length fields are unsigned, so the "< 0" checks on them in
populate_ddr_handoff() can never be true. Remove these dead comparisons.
Signed-off-by: Chen Huei Lok <[email protected]>
---
drivers/ddr/altera/sdram_n5x.c | 32 ++++++--------------------------
1 file changed, 6 insertions(+), 26 deletions(-)
diff --git a/drivers/ddr/altera/sdram_n5x.c b/drivers/ddr/altera/sdram_n5x.c
index be512cd33b1..558415d7931 100644
--- a/drivers/ddr/altera/sdram_n5x.c
+++ b/drivers/ddr/altera/sdram_n5x.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
- * Copyright (C) 2020-2022 Intel Corporation <www.intel.com>
+ * Copyright (C) 2020-2023 Intel Corporation <www.intel.com>
*
*/
@@ -1731,12 +1731,6 @@ int populate_ddr_handoff(struct ddr_handoff *handoff)
debug("%s: Umctl2 handoff length in word(32-bit) = 0x%x\n", __func__,
(u32)handoff->cntlr_handoff_length);
- /* Wrong format on user setting data */
- if (handoff->cntlr_handoff_length < 0) {
- debug("%s: Wrong format on user setting data\n", __func__);
- return -ENOEXEC;
- }
-
/* Get the next handoff section address */
next_section_header = handoff->cntlr_handoff_base +
handoff->cntlr_total_length;
@@ -1789,13 +1783,6 @@ int populate_ddr_handoff(struct ddr_handoff *handoff)
__func__,
(u32)handoff->cntlr2_handoff_length);
- /* Wrong format on user setting data */
- if (handoff->cntlr2_handoff_length < 0) {
- debug("%s: Wrong format on umctl2 user setting data\n",
- __func__);
- return -ENOEXEC;
- }
-
/* Get the next handoff section address */
next_section_header = handoff->cntlr2_handoff_base +
handoff->cntlr2_total_length;
@@ -1831,13 +1818,6 @@ int populate_ddr_handoff(struct ddr_handoff *handoff)
debug("%s: PHY handoff length in word(32-bit) = 0x%x\n",
__func__, (u32)handoff->phy_handoff_length);
- /* Wrong format on PHY user setting data */
- if (handoff->phy_handoff_length < 0) {
- debug("%s: Wrong format on PHY user setting data\n",
- __func__);
- return -ENOEXEC;
- }
-
/* Get the next handoff section address */
next_section_header = handoff->phy_handoff_base +
handoff->phy_total_length;
@@ -1875,11 +1855,11 @@ int populate_ddr_handoff(struct ddr_handoff *handoff)
debug("%s: PHY engine handoff length in word(32-bit) = 0x%x\n",
__func__, (u32)handoff->phy_engine_handoff_length);
- /* Wrong format on PHY init engine setting data */
- if (handoff->phy_engine_handoff_length < 0) {
- debug("%s: Wrong format on PHY init engine ",
- __func__);
- debug("user setting data\n");
+ /* Checking DDR handoff is overflow? */
+ if (SOC64_OCRAM_PHY_BACKUP_BASE <=
+ (handoff->phy_engine_handoff_base +
+ handoff->phy_engine_total_length)) {
+ printf("%s: DDR handoff is overflow\n ", __func__);
return -ENOEXEC;
}
Reviewed-by: Tien Fong Chee <[email protected]>
Best regards,
Tien Fong