From e83812f11a2d725931de88308c5b520d88bcca86 Mon Sep 17 00:00:00 2001 From: Maninder Singh Date: Mon, 17 Oct 2022 03:54:16 -0700 Subject: [PATCH] fix(nxp-ddr): add checking return value Coverity Issue 21268351 Fixed unused value of xspi read while reading training values from xspi during warm reset. Signed-off-by: Maninder Singh Signed-off-by: Jiafei Pan Change-Id: I779587afedb1c73d174a132bbfbcb21bf45bdff8 --- drivers/nxp/ddr/phy-gen2/phy.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/nxp/ddr/phy-gen2/phy.c b/drivers/nxp/ddr/phy-gen2/phy.c index 5fd9cb5c5..2006c04e8 100644 --- a/drivers/nxp/ddr/phy-gen2/phy.c +++ b/drivers/nxp/ddr/phy-gen2/phy.c @@ -503,6 +503,14 @@ int restore_phy_training_values(uint16_t **phy_ptr, uint32_t address_to_restore, /* Reading 1D training values from flash*/ ret = xspi_read(phy_store, (uint32_t *)training_1D_values, size); + if (ret != 0) { +#ifdef DEBUG_WARM_RESET + debug("Unable to Read 1D training values %d\n", + ret); +#endif + return -EINVAL; + } + debug("Restoring 1D Training reg val at:%08x\n", phy_store); for (i = 0; i < num_of_regs; i++) { phy_io_write16(phy, training_1D_values[i].addr, @@ -522,6 +530,15 @@ int restore_phy_training_values(uint16_t **phy_ptr, uint32_t address_to_restore, /* Reading 2D training values from flash */ ret = xspi_read(phy_store, (uint32_t *)training_2D_values, size); + + if (ret != 0) { +#ifdef DEBUG_WARM_RESET + debug("Unable to Read 2D training values %d\n", + ret); +#endif + return -EINVAL; + } + debug("Restoring 2D Training reg val at:%08x\n", phy_store); for (i = 0; i < num_of_regs; i++) { -- 2.39.5