staging: unisys: visorbus: add error handling to chipset_device_pause/resume
authorDavid Kershner <david.kershner@unisys.com>
Tue, 28 Mar 2017 13:34:54 +0000 (09:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Mar 2017 07:17:03 +0000 (09:17 +0200)
If there is an error in chipset_device_pause/resume don't try to respond,
error out and let the calling functions respond to this error just like
any other error they encounter.

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

index 58e4009ae21f30d62d98eab3ad5766a91c9c6598..e094a506efc91f2256877f10b6e3656baa0258e6 100644 (file)
@@ -1241,7 +1241,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause)
  * that device.  Success/failure result is returned asynchronously
  * via a callback function; see pause_state_change_complete().
  */
-void
+int
 chipset_device_pause(struct visor_device *dev_info)
 {
        int err;
@@ -1250,8 +1250,10 @@ chipset_device_pause(struct visor_device *dev_info)
 
        if (err < 0) {
                dev_info->pausing = false;
-               device_pause_response(dev_info, err);
+               return err;
        }
+
+       return 0;
 }
 
 /**
@@ -1262,7 +1264,7 @@ chipset_device_pause(struct visor_device *dev_info)
  * that device.  Success/failure result is returned asynchronously
  * via a callback function; see resume_state_change_complete().
  */
-void
+int
 chipset_device_resume(struct visor_device *dev_info)
 {
        int err;
@@ -1270,9 +1272,11 @@ chipset_device_resume(struct visor_device *dev_info)
        err = initiate_chipset_device_pause_resume(dev_info, false);
 
        if (err < 0) {
-               device_resume_response(dev_info, err);
                dev_info->resuming = false;
+               return err;
        }
+
+       return 0;
 }
 
 int
index 7efe4d4c0d27bf106f27d5ec3197bc71f66c9bed..9f030b1f589f0afcc1997e597a1b0a31426fc55d 100644 (file)
@@ -31,8 +31,8 @@ int chipset_bus_create(struct visor_device *bus_info);
 void chipset_bus_destroy(struct visor_device *bus_info);
 int chipset_device_create(struct visor_device *dev_info);
 void chipset_device_destroy(struct visor_device *dev_info);
-void chipset_device_pause(struct visor_device *dev_info);
-void chipset_device_resume(struct visor_device *dev_info);
+int chipset_device_pause(struct visor_device *dev_info);
+int chipset_device_resume(struct visor_device *dev_info);
 
 void bus_create_response(struct visor_device *p, int response);
 void bus_destroy_response(struct visor_device *p, int response);
index be1171e00ea32f1b386a910a3000a7e9f3ff777b..260307b83a2fa60f98fbffe97fee969e30ba3ed1 100644 (file)
@@ -883,7 +883,7 @@ my_device_changestate(struct controlvm_message *inmsg)
        u32 dev_no = cmd->device_change_state.dev_no;
        struct spar_segment_state state = cmd->device_change_state.state;
        struct visor_device *dev_info;
-       int err;
+       int err = 0;
 
        dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
        if (!dev_info) {
@@ -918,7 +918,7 @@ my_device_changestate(struct controlvm_message *inmsg)
        if (state.alive == segment_state_running.alive &&
            state.operating == segment_state_running.operating)
                /* Response will be sent from chipset_device_resume */
-               chipset_device_resume(dev_info);
+               err = chipset_device_resume(dev_info);
        /* ServerNotReady / ServerLost / SegmentStateStandby */
        else if (state.alive == segment_state_standby.alive &&
                 state.operating == segment_state_standby.operating)
@@ -926,7 +926,10 @@ my_device_changestate(struct controlvm_message *inmsg)
                 * technically this is standby case where server is lost.
                 * Response will be sent from chipset_device_pause.
                 */
-               chipset_device_pause(dev_info);
+               err = chipset_device_pause(dev_info);
+       if (err)
+               goto err_respond;
+
        return 0;
 
 err_respond: