summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorbus/visorchipset.c
diff options
context:
space:
mode:
authorDavid Binder2016-12-22 17:08:59 +0100
committerGreg Kroah-Hartman2017-01-03 15:17:02 +0100
commit36309d3b105c650eb0398afd1675df30fb570e5d (patch)
treeffa7a8ce017091e90a7b66c21778b83e5940f6ae /drivers/staging/unisys/visorbus/visorchipset.c
parentstaging: unisys: visorbus: shorten error message defines (diff)
downloadkernel-qcow2-linux-36309d3b105c650eb0398afd1675df30fb570e5d.tar.gz
kernel-qcow2-linux-36309d3b105c650eb0398afd1675df30fb570e5d.tar.xz
kernel-qcow2-linux-36309d3b105c650eb0398afd1675df30fb570e5d.zip
staging: unisys: visorbus: Use switch statement instead of conditionals
Control flow is now directed using a switch statement, triggered by the enum crash_obj_type function parameter, instead of a set of conditional statements. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David Binder <david.binder@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys/visorbus/visorchipset.c')
-rw-r--r--drivers/staging/unisys/visorbus/visorchipset.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 2dd8930e1d81..275653ac6a68 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -613,27 +613,33 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ)
return err;
}
- if (typ == CRASH_BUS) {
+ switch (typ) {
+ case CRASH_DEV:
+ local_crash_msg_offset += sizeof(struct controlvm_message);
err = visorchannel_write(controlvm_channel,
local_crash_msg_offset,
msg,
- sizeof(struct controlvm_message));
+ sizeof(struct controlvm_message));
if (err) {
- POSTCODE_LINUX(SAVE_MSG_BUS_FAILURE_PC, 0, 0,
+ POSTCODE_LINUX(SAVE_MSG_DEV_FAILURE_PC, 0, 0,
DIAG_SEVERITY_ERR);
return err;
}
- } else {
- local_crash_msg_offset += sizeof(struct controlvm_message);
+ break;
+ case CRASH_BUS:
err = visorchannel_write(controlvm_channel,
local_crash_msg_offset,
msg,
sizeof(struct controlvm_message));
if (err) {
- POSTCODE_LINUX(SAVE_MSG_DEV_FAILURE_PC, 0, 0,
+ POSTCODE_LINUX(SAVE_MSG_BUS_FAILURE_PC, 0, 0,
DIAG_SEVERITY_ERR);
return err;
}
+ break;
+ default:
+ pr_info("Invalid crash_obj_type\n");
+ break;
}
return 0;
}