From 0825f191ec603b29f0586b5c6a8592145079007f Mon Sep 17 00:00:00 2001 From: David Kershner Date: Thu, 3 Nov 2016 11:44:25 -0400 Subject: [PATCH] staging: unisys: visorbus: my_device_changestate: add error response The function my_device_changestate was not sending a response if there was an error with the CONTROLVM message. Signed-off-by: David Kershner Reported-by: Greg Kroah-Hartman Reviewed-by: Tim Sell Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index d10712147601..f8dca04b1219 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1046,15 +1046,22 @@ my_device_changestate(struct controlvm_message *inmsg) POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; - } else if (dev_info->state.created == 0) { + goto err_respond; + } + if (dev_info->state.created == 0) { POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; + goto err_respond; } - if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info) - device_epilog(dev_info, state, - CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc, - inmsg->hdr.flags.response_expected == 1, 1); + + device_epilog(dev_info, state, + CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc, + inmsg->hdr.flags.response_expected == 1, 1); + return; + +err_respond: + device_responder(inmsg->hdr.id, &inmsg->hdr, rc); } static void -- 2.20.1