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 58e4009..e094a50 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 7efe4d4..9f030b1 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 be1171e..260307b 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: