]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(nxp-ddr): add checking return value
authorManinder Singh <maninder.singh_1@nxp.com>
Mon, 17 Oct 2022 10:54:16 +0000 (03:54 -0700)
committerJiafei Pan <Jiafei.Pan@nxp.com>
Tue, 6 Dec 2022 14:46:10 +0000 (22:46 +0800)
Coverity Issue 21268351
Fixed unused value of xspi read while reading training values from
xspi during warm reset.

Signed-off-by: Maninder Singh <maninder.singh_1@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I779587afedb1c73d174a132bbfbcb21bf45bdff8

drivers/nxp/ddr/phy-gen2/phy.c

index 5fd9cb5c5936fa6a1411837845bec16e70da7a9e..2006c04e895b77f0853d437b2a191ea537278338 100644 (file)
@@ -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++) {