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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
98f9ed9ecb
commit
36309d3b10
@@ -613,17 +613,8 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typ == CRASH_BUS) {
|
switch (typ) {
|
||||||
err = visorchannel_write(controlvm_channel,
|
case CRASH_DEV:
|
||||||
local_crash_msg_offset,
|
|
||||||
msg,
|
|
||||||
sizeof(struct controlvm_message));
|
|
||||||
if (err) {
|
|
||||||
POSTCODE_LINUX(SAVE_MSG_BUS_FAILURE_PC, 0, 0,
|
|
||||||
DIAG_SEVERITY_ERR);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
local_crash_msg_offset += sizeof(struct controlvm_message);
|
local_crash_msg_offset += sizeof(struct controlvm_message);
|
||||||
err = visorchannel_write(controlvm_channel,
|
err = visorchannel_write(controlvm_channel,
|
||||||
local_crash_msg_offset,
|
local_crash_msg_offset,
|
||||||
@@ -634,6 +625,21 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ)
|
|||||||
DIAG_SEVERITY_ERR);
|
DIAG_SEVERITY_ERR);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case CRASH_BUS:
|
||||||
|
err = visorchannel_write(controlvm_channel,
|
||||||
|
local_crash_msg_offset,
|
||||||
|
msg,
|
||||||
|
sizeof(struct controlvm_message));
|
||||||
|
if (err) {
|
||||||
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user