diff options
author | Laurent Vivier <lvivier@redhat.com> | 2018-03-23 15:32:02 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2018-05-20 08:48:13 +0300 |
commit | 4a4ff4c58fd750cde01c8b15d30d038cefc90a42 (patch) | |
tree | 663380d3786b808f7829236f2d085b437d4edb71 /target | |
parent | f23c81073a4f9aa41a3687161f6ca3d66501a280 (diff) |
Remove unnecessary variables for function return value
Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
ppc part
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'target')
-rw-r--r-- | target/i386/hax-darwin.c | 10 | ||||
-rw-r--r-- | target/mips/dsp_helper.c | 15 | ||||
-rw-r--r-- | target/xtensa/core-dc232b/xtensa-modules.inc.c | 56 | ||||
-rw-r--r-- | target/xtensa/core-dc233c/xtensa-modules.inc.c | 56 | ||||
-rw-r--r-- | target/xtensa/core-de212/xtensa-modules.inc.c | 48 | ||||
-rw-r--r-- | target/xtensa/core-fsf/xtensa-modules.inc.c | 32 | ||||
-rw-r--r-- | target/xtensa/core-sample_controller/xtensa-modules.inc.c | 24 | ||||
-rw-r--r-- | target/xtensa/translate.c | 7 |
8 files changed, 62 insertions, 186 deletions
diff --git a/target/i386/hax-darwin.c b/target/i386/hax-darwin.c index acdde476a0..a5426a6dac 100644 --- a/target/i386/hax-darwin.c +++ b/target/i386/hax-darwin.c @@ -257,10 +257,7 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) int hax_vcpu_run(struct hax_vcpu_state *vcpu) { - int ret; - - ret = ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL); - return ret; + return ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL); } int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set) @@ -315,13 +312,12 @@ int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state, int set) int hax_inject_interrupt(CPUArchState *env, int vector) { - int ret, fd; + int fd; fd = hax_vcpu_get_fd(env); if (fd <= 0) { return -1; } - ret = ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector); - return ret; + return ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector); } diff --git a/target/mips/dsp_helper.c b/target/mips/dsp_helper.c index f152fea34a..739b69dd45 100644 --- a/target/mips/dsp_helper.c +++ b/target/mips/dsp_helper.c @@ -3274,14 +3274,11 @@ target_ulong helper_dextr_l(target_ulong ac, target_ulong shift, CPUMIPSState *env) { uint64_t temp[3]; - target_ulong result; shift = shift & 0x3F; mipsdsp_rndrashift_acc(temp, ac, shift, env); - result = (temp[1] << 63) | (temp[0] >> 1); - - return result; + return (temp[1] << 63) | (temp[0] >> 1); } target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift, @@ -3289,7 +3286,6 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift, { uint64_t temp[3]; uint32_t temp128; - target_ulong result; shift = shift & 0x3F; mipsdsp_rndrashift_acc(temp, ac, shift, env); @@ -3309,9 +3305,7 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift, set_DSPControl_overflow_flag(1, 23, env); } - result = (temp[1] << 63) | (temp[0] >> 1); - - return result; + return (temp[1] << 63) | (temp[0] >> 1); } target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift, @@ -3319,7 +3313,6 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift, { uint64_t temp[3]; uint32_t temp128; - target_ulong result; shift = shift & 0x3F; mipsdsp_rndrashift_acc(temp, ac, shift, env); @@ -3345,9 +3338,7 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift, } set_DSPControl_overflow_flag(1, 23, env); } - result = (temp[1] << 63) | (temp[0] >> 1); - - return result; + return (temp[1] << 63) | (temp[0] >> 1); } #endif diff --git a/target/xtensa/core-dc232b/xtensa-modules.inc.c b/target/xtensa/core-dc232b/xtensa-modules.inc.c index d322c3f52a..164df3b1a4 100644 --- a/target/xtensa/core-dc232b/xtensa-modules.inc.c +++ b/target/xtensa/core-dc232b/xtensa-modules.inc.c @@ -1736,9 +1736,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_arr_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1750,9 +1748,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ars_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1764,9 +1760,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_art_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1778,9 +1772,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar0_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1792,9 +1784,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar4_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1806,9 +1796,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar8_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1820,9 +1808,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar12_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1834,9 +1820,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ars_entry_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -2406,9 +2390,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mx_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2436,9 +2418,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mw_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2450,9 +2430,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr0_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2464,9 +2442,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr1_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2478,9 +2454,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr2_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2492,9 +2466,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr3_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int diff --git a/target/xtensa/core-dc233c/xtensa-modules.inc.c b/target/xtensa/core-dc233c/xtensa-modules.inc.c index 7c20f82349..0f32f0804a 100644 --- a/target/xtensa/core-dc233c/xtensa-modules.inc.c +++ b/target/xtensa/core-dc233c/xtensa-modules.inc.c @@ -1817,9 +1817,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_arr_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1831,9 +1829,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ars_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1845,9 +1841,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_art_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1859,9 +1853,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar0_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1873,9 +1865,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar4_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1887,9 +1877,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar8_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1901,9 +1889,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar12_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -1915,9 +1901,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ars_entry_encode (uint32 *valp) { - int error; - error = (*valp & ~0x1f) != 0; - return error; + return (*valp & ~0x1f) != 0; } static int @@ -2487,9 +2471,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mx_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2517,9 +2499,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mw_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2531,9 +2511,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr0_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2545,9 +2523,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr1_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2559,9 +2535,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr2_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int @@ -2573,9 +2547,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_mr3_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3) != 0; - return error; + return (*valp & ~0x3) != 0; } static int diff --git a/target/xtensa/core-de212/xtensa-modules.inc.c b/target/xtensa/core-de212/xtensa-modules.inc.c index ef7674de3a..480c68d3c6 100644 --- a/target/xtensa/core-de212/xtensa-modules.inc.c +++ b/target/xtensa/core-de212/xtensa-modules.inc.c @@ -1798,9 +1798,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1812,9 +1810,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_0_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1826,9 +1822,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_1_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1840,9 +1834,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_2_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1854,9 +1846,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_3_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1868,9 +1858,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_4_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -2464,9 +2452,7 @@ OperandSem_opnd_sem_MR_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_MR_encode (uint32 *valp) { - int error; - error = (*valp >= 4); - return error; + return (*valp >= 4); } static int @@ -2478,9 +2464,7 @@ OperandSem_opnd_sem_MR_1_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_MR_1_encode (uint32 *valp) { - int error; - error = (*valp >= 4); - return error; + return (*valp >= 4); } static int @@ -2492,9 +2476,7 @@ OperandSem_opnd_sem_MR_2_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_MR_2_encode (uint32 *valp) { - int error; - error = (*valp >= 4); - return error; + return (*valp >= 4); } static int @@ -2506,9 +2488,7 @@ OperandSem_opnd_sem_MR_3_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_MR_3_encode (uint32 *valp) { - int error; - error = (*valp >= 4); - return error; + return (*valp >= 4); } static int @@ -2520,9 +2500,7 @@ OperandSem_opnd_sem_MR_4_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_MR_4_encode (uint32 *valp) { - int error; - error = (*valp >= 4); - return error; + return (*valp >= 4); } static int @@ -2534,9 +2512,7 @@ OperandSem_opnd_sem_MR_5_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_MR_5_encode (uint32 *valp) { - int error; - error = (*valp >= 4); - return error; + return (*valp >= 4); } static int diff --git a/target/xtensa/core-fsf/xtensa-modules.inc.c b/target/xtensa/core-fsf/xtensa-modules.inc.c index f7de2dec15..c32683ff77 100644 --- a/target/xtensa/core-fsf/xtensa-modules.inc.c +++ b/target/xtensa/core-fsf/xtensa-modules.inc.c @@ -1379,9 +1379,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_arr_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1393,9 +1391,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ars_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1407,9 +1403,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_art_encode (uint32 *valp) { - int error; - error = (*valp & ~0xf) != 0; - return error; + return (*valp & ~0xf) != 0; } static int @@ -1421,9 +1415,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar0_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3f) != 0; - return error; + return (*valp & ~0x3f) != 0; } static int @@ -1435,9 +1427,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar4_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3f) != 0; - return error; + return (*valp & ~0x3f) != 0; } static int @@ -1449,9 +1439,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar8_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3f) != 0; - return error; + return (*valp & ~0x3f) != 0; } static int @@ -1463,9 +1451,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ar12_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3f) != 0; - return error; + return (*valp & ~0x3f) != 0; } static int @@ -1477,9 +1463,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED) static int Operand_ars_entry_encode (uint32 *valp) { - int error; - error = (*valp & ~0x3f) != 0; - return error; + return (*valp & ~0x3f) != 0; } static int diff --git a/target/xtensa/core-sample_controller/xtensa-modules.inc.c b/target/xtensa/core-sample_controller/xtensa-modules.inc.c index fba41b99ae..7e87d216bd 100644 --- a/target/xtensa/core-sample_controller/xtensa-modules.inc.c +++ b/target/xtensa/core-sample_controller/xtensa-modules.inc.c @@ -1570,9 +1570,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1584,9 +1582,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_0_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1598,9 +1594,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_1_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1612,9 +1606,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_2_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1626,9 +1618,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_3_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int @@ -1640,9 +1630,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED) static int OperandSem_opnd_sem_AR_4_encode (uint32 *valp) { - int error; - error = (*valp >= 32); - return error; + return (*valp >= 32); } static int diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index ae0feb0254..df0e7ba63d 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1271,11 +1271,8 @@ XtensaOpcodeOps * xtensa_find_opcode_ops(const XtensaOpcodeTranslators *t, const char *name) { - XtensaOpcodeOps *ops; - - ops = bsearch(name, t->opcode, t->num_opcodes, - sizeof(XtensaOpcodeOps), compare_opcode_ops); - return ops; + return bsearch(name, t->opcode, t->num_opcodes, + sizeof(XtensaOpcodeOps), compare_opcode_ops); } static void translate_abs(DisasContext *dc, const uint32_t arg[], |