target/riscv-013: fix unused initialization
[fw/openocd] / src / target / riscv / riscv-013.c
index d513df7cae0750c0ffbda2cfe137a226306b7f39..99d3873de84ccdd62dd1ac2ed94f91fd58c0f704 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /*
  * Support for RISC-V, debug version 0.13, which is currently (2/4/17) the
@@ -2359,9 +2359,7 @@ static int assert_reset(struct target *target)
                /* TODO: Try to use hasel in dmcontrol */
 
                /* Set haltreq for each hart. */
-               uint32_t control = control_base;
-
-               control = set_hartsel(control_base, target->coreid);
+               uint32_t control = set_hartsel(control_base, target->coreid);
                control = set_field(control, DM_DMCONTROL_HALTREQ,
                                target->reset_halt ? 1 : 0);
                dmi_write(target, DM_DMCONTROL, control);
@@ -4463,7 +4461,9 @@ static int riscv013_test_sba_config_reg(struct target *target,
 
        uint32_t rd_val;
        uint32_t sbcs_orig;
-       dmi_read(target, &sbcs_orig, DM_SBCS);
+       int retval = dmi_read(target, &sbcs_orig, DM_SBCS);
+       if (retval != ERROR_OK)
+               return retval;
 
        uint32_t sbcs = sbcs_orig;
        bool test_passed;