diff options
author | David Kershner | 2016-11-21 18:15:48 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2016-11-23 10:01:57 +0100 |
commit | 8dff01f7d07a4df45572b57727035d71ccef5801 (patch) | |
tree | 5cb4a3f48e129064009d98b6d66edee9439b9394 /drivers/staging/unisys/visorbus/visorchipset.c | |
parent | staging: unisys: visorbus: controlvm_respond_physdev_changestate add error ha... (diff) | |
download | kernel-qcow2-linux-8dff01f7d07a4df45572b57727035d71ccef5801.tar.gz kernel-qcow2-linux-8dff01f7d07a4df45572b57727035d71ccef5801.tar.xz kernel-qcow2-linux-8dff01f7d07a4df45572b57727035d71ccef5801.zip |
staging: unisys: visorbus: save_crash_message add error handling
Add proper error handling to the function save_crash_message.
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index e081de32464a..034ff91ead5d 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -579,57 +579,63 @@ enum crash_obj_type { CRASH_BUS, }; -static void +static int save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ) { u32 local_crash_msg_offset; u16 local_crash_msg_count; + int err; - if (visorchannel_read(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - saved_crash_message_count), - &local_crash_msg_count, sizeof(u16)) < 0) { + err = visorchannel_read(controlvm_channel, + offsetof(struct spar_controlvm_channel_protocol, + saved_crash_message_count), + &local_crash_msg_count, sizeof(u16)); + if (err) { POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); - return; + return err; } if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC, local_crash_msg_count, POSTCODE_SEVERITY_ERR); - return; + return -EIO; } - if (visorchannel_read(controlvm_channel, - offsetof(struct spar_controlvm_channel_protocol, - saved_crash_message_offset), - &local_crash_msg_offset, sizeof(u32)) < 0) { + err = visorchannel_read(controlvm_channel, + offsetof(struct spar_controlvm_channel_protocol, + saved_crash_message_offset), + &local_crash_msg_offset, sizeof(u32)); + if (err) { POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC, POSTCODE_SEVERITY_ERR); - return; + return err; } if (typ == CRASH_BUS) { - if (visorchannel_write(controlvm_channel, - local_crash_msg_offset, - msg, - sizeof(struct controlvm_message)) < 0) { + err = visorchannel_write(controlvm_channel, + local_crash_msg_offset, + msg, + sizeof(struct controlvm_message)); + if (err) { POSTCODE_LINUX_2(SAVE_MSG_BUS_FAILURE_PC, POSTCODE_SEVERITY_ERR); - return; + return err; } } else { local_crash_msg_offset += sizeof(struct controlvm_message); - if (visorchannel_write(controlvm_channel, - local_crash_msg_offset, - msg, - sizeof(struct controlvm_message)) < 0) { + err = visorchannel_write(controlvm_channel, + local_crash_msg_offset, + msg, + sizeof(struct controlvm_message)); + if (err) { POSTCODE_LINUX_2(SAVE_MSG_DEV_FAILURE_PC, POSTCODE_SEVERITY_ERR); - return; + return err; } } + return 0; } static void |