Commit b4a8e6ae authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman

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: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarReviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 15d9ce9d
...@@ -1241,7 +1241,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) ...@@ -1241,7 +1241,7 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause)
* that device. Success/failure result is returned asynchronously * that device. Success/failure result is returned asynchronously
* via a callback function; see pause_state_change_complete(). * via a callback function; see pause_state_change_complete().
*/ */
void int
chipset_device_pause(struct visor_device *dev_info) chipset_device_pause(struct visor_device *dev_info)
{ {
int err; int err;
...@@ -1250,8 +1250,10 @@ chipset_device_pause(struct visor_device *dev_info) ...@@ -1250,8 +1250,10 @@ chipset_device_pause(struct visor_device *dev_info)
if (err < 0) { if (err < 0) {
dev_info->pausing = false; 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) ...@@ -1262,7 +1264,7 @@ chipset_device_pause(struct visor_device *dev_info)
* that device. Success/failure result is returned asynchronously * that device. Success/failure result is returned asynchronously
* via a callback function; see resume_state_change_complete(). * via a callback function; see resume_state_change_complete().
*/ */
void int
chipset_device_resume(struct visor_device *dev_info) chipset_device_resume(struct visor_device *dev_info)
{ {
int err; int err;
...@@ -1270,9 +1272,11 @@ chipset_device_resume(struct visor_device *dev_info) ...@@ -1270,9 +1272,11 @@ chipset_device_resume(struct visor_device *dev_info)
err = initiate_chipset_device_pause_resume(dev_info, false); err = initiate_chipset_device_pause_resume(dev_info, false);
if (err < 0) { if (err < 0) {
device_resume_response(dev_info, err);
dev_info->resuming = false; dev_info->resuming = false;
return err;
} }
return 0;
} }
int int
......
...@@ -31,8 +31,8 @@ int chipset_bus_create(struct visor_device *bus_info); ...@@ -31,8 +31,8 @@ int chipset_bus_create(struct visor_device *bus_info);
void chipset_bus_destroy(struct visor_device *bus_info); void chipset_bus_destroy(struct visor_device *bus_info);
int chipset_device_create(struct visor_device *dev_info); int chipset_device_create(struct visor_device *dev_info);
void chipset_device_destroy(struct visor_device *dev_info); void chipset_device_destroy(struct visor_device *dev_info);
void chipset_device_pause(struct visor_device *dev_info); int chipset_device_pause(struct visor_device *dev_info);
void chipset_device_resume(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_create_response(struct visor_device *p, int response);
void bus_destroy_response(struct visor_device *p, int response); void bus_destroy_response(struct visor_device *p, int response);
......
...@@ -883,7 +883,7 @@ my_device_changestate(struct controlvm_message *inmsg) ...@@ -883,7 +883,7 @@ my_device_changestate(struct controlvm_message *inmsg)
u32 dev_no = cmd->device_change_state.dev_no; u32 dev_no = cmd->device_change_state.dev_no;
struct spar_segment_state state = cmd->device_change_state.state; struct spar_segment_state state = cmd->device_change_state.state;
struct visor_device *dev_info; struct visor_device *dev_info;
int err; int err = 0;
dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL); dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
if (!dev_info) { if (!dev_info) {
...@@ -918,7 +918,7 @@ my_device_changestate(struct controlvm_message *inmsg) ...@@ -918,7 +918,7 @@ my_device_changestate(struct controlvm_message *inmsg)
if (state.alive == segment_state_running.alive && if (state.alive == segment_state_running.alive &&
state.operating == segment_state_running.operating) state.operating == segment_state_running.operating)
/* Response will be sent from chipset_device_resume */ /* Response will be sent from chipset_device_resume */
chipset_device_resume(dev_info); err = chipset_device_resume(dev_info);
/* ServerNotReady / ServerLost / SegmentStateStandby */ /* ServerNotReady / ServerLost / SegmentStateStandby */
else if (state.alive == segment_state_standby.alive && else if (state.alive == segment_state_standby.alive &&
state.operating == segment_state_standby.operating) state.operating == segment_state_standby.operating)
...@@ -926,7 +926,10 @@ my_device_changestate(struct controlvm_message *inmsg) ...@@ -926,7 +926,10 @@ my_device_changestate(struct controlvm_message *inmsg)
* technically this is standby case where server is lost. * technically this is standby case where server is lost.
* Response will be sent from chipset_device_pause. * 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; return 0;
err_respond: err_respond:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment