From 963764081d84f25ecc6aff0d49e074c150910e6a Mon Sep 17 00:00:00 2001 From: Halil Pasic Date: Tue, 17 Oct 2017 16:04:50 +0200 Subject: s390x: refactor error handling for XSCH handler Simplify the error handling of the XSCH. Let the code detecting the condition tell (in a less ambiguous way) how it's to be handled. No changes in behavior. Signed-off-by: Halil Pasic Message-Id: <20171017140453.51099-5-pasic@linux.vnet.ibm.com> Reviewed-by: Thomas Huth Reviewed-by: Dong Jia Shi Signed-off-by: Cornelia Huck --- target/s390x/ioinst.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'target/s390x') diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 16b5cf2..4ad07e9 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -42,8 +42,6 @@ void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1) { int cssid, ssid, schid, m; SubchDev *sch; - int ret = -ENODEV; - int cc; if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { program_interrupt(&cpu->env, PGM_OPERAND, 4); @@ -51,24 +49,11 @@ void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1) } trace_ioinst_sch_id("xsch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); - if (sch && css_subch_visible(sch)) { - ret = css_do_xsch(sch); - } - switch (ret) { - case -ENODEV: - cc = 3; - break; - case -EBUSY: - cc = 2; - break; - case 0: - cc = 0; - break; - default: - cc = 1; - break; + if (!sch || !css_subch_visible(sch)) { + setcc(cpu, 3); + return; } - setcc(cpu, cc); + setcc(cpu, css_do_xsch(sch)); } void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1) -- cgit v1.1