From b4a8e6ae1744b775fd3656e6b83cbbdaa06fb73c Mon Sep 17 00:00:00 2001 From: David Kershner Date: Tue, 28 Mar 2017 09:34:54 -0400 Subject: staging: unisys: visorbus: add error handling to chipset_device_pause/resume 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 Reviewed-by: Reviewed-by: Tim Sell Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 12 ++++++++---- drivers/staging/unisys/visorbus/visorbus_private.h | 4 ++-- drivers/staging/unisys/visorbus/visorchipset.c | 9 ++++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 58e4009ae21f..e094a506efc9 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -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 diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 7efe4d4c0d27..9f030b1f589f 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -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); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index be1171e00ea3..260307b83a2f 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -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: -- cgit v1.2.3