armv8: fix five dead assignments

Clang scan-build complains for five dead assignments:
	Value stored to 'retval' is never read

Check the returned value and propagate the error.

Change-Id: I01172887a056d6f39ddcf2807848423970db1e89
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6590
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2021-09-22 19:09:29 +02:00
parent 48d74f9711
commit 01de751025
1 changed files with 16 additions and 8 deletions

View File

@ -454,29 +454,31 @@ static int armv8_read_reg_simdfp_aarch32(struct armv8_common *armv8, int regnum,
retval = dpm->instr_read_data_r0(dpm,
ARMV4_5_VMOV(1, 1, 0, (num >> 4), (num & 0xf)),
&value_r0);
if (retval != ERROR_OK)
return retval;
/* read r1 via dcc */
retval = dpm->instr_read_data_dcc(dpm,
ARMV4_5_MCR(14, 0, 1, 0, 5, 0),
&value_r1);
if (retval == ERROR_OK) {
*lvalue = value_r1;
*lvalue = ((*lvalue) << 32) | value_r0;
} else
if (retval != ERROR_OK)
return retval;
*lvalue = value_r1;
*lvalue = ((*lvalue) << 32) | value_r0;
num++;
/* repeat above steps for high 64 bits of V register */
retval = dpm->instr_read_data_r0(dpm,
ARMV4_5_VMOV(1, 1, 0, (num >> 4), (num & 0xf)),
&value_r0);
if (retval != ERROR_OK)
return retval;
retval = dpm->instr_read_data_dcc(dpm,
ARMV4_5_MCR(14, 0, 1, 0, 5, 0),
&value_r1);
if (retval == ERROR_OK) {
*hvalue = value_r1;
*hvalue = ((*hvalue) << 32) | value_r0;
} else
if (retval != ERROR_OK)
return retval;
*hvalue = value_r1;
*hvalue = ((*hvalue) << 32) | value_r0;
break;
default:
retval = ERROR_FAIL;
@ -586,12 +588,16 @@ static int armv8_write_reg_simdfp_aarch32(struct armv8_common *armv8, int regnum
retval = dpm->instr_write_data_dcc(dpm,
ARMV4_5_MRC(14, 0, 1, 0, 5, 0),
value_r1);
if (retval != ERROR_OK)
return retval;
/* write value_r0 to r0 via dcc then,
* move to double word register from r0:r1: "vmov vm, r0, r1"
*/
retval = dpm->instr_write_data_r0(dpm,
ARMV4_5_VMOV(0, 1, 0, (num >> 4), (num & 0xf)),
value_r0);
if (retval != ERROR_OK)
return retval;
num++;
/* repeat above steps for high 64 bits of V register */
@ -600,6 +606,8 @@ static int armv8_write_reg_simdfp_aarch32(struct armv8_common *armv8, int regnum
retval = dpm->instr_write_data_dcc(dpm,
ARMV4_5_MRC(14, 0, 1, 0, 5, 0),
value_r1);
if (retval != ERROR_OK)
return retval;
retval = dpm->instr_write_data_r0(dpm,
ARMV4_5_VMOV(0, 1, 0, (num >> 4), (num & 0xf)),
value_r0);