staging: unisys: visorbus: my_device_changestate: add error response
authorDavid Kershner <david.kershner@unisys.com>
Thu, 3 Nov 2016 15:44:25 +0000 (11:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Nov 2016 09:56:39 +0000 (10:56 +0100)
The function my_device_changestate was not sending a response if there
was an error with the CONTROLVM message.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorbus/visorchipset.c

index d10712147601bf12e93f10fece26ba3044860c0e..f8dca04b12192ed90a25154514ceeb0670443329 100644 (file)
@@ -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