adi_v5_jtag: add missing error handling
[fw/openocd] / src / target / adi_v5_jtag.c
index b3687084c8bef37987e2d7a73a14dd1c71dc9f2e..44f624f3a50134e00a4603b18e77131fb04bcf32 100644 (file)
@@ -259,7 +259,11 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap)
                LOG_DEBUG("jtag-dp: CTRL/STAT error, 0x%" PRIx32, ctrlstat);
                /* Check power to debug regions */
                if ((ctrlstat & 0xf0000000) != 0xf0000000)
-                        ahbap_debugport_init(dap);
+               {
+                       retval = ahbap_debugport_init(dap);
+                       if (retval != ERROR_OK)
+                               return retval;
+               }
                else
                {
                        uint32_t mem_ap_csw, mem_ap_tar;