summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorbus/visorchipset.c
diff options
context:
space:
mode:
authorDavid Kershner2016-12-22 17:09:07 +0100
committerGreg Kroah-Hartman2017-01-03 15:19:06 +0100
commite795491822c4c5bbb2c0d016676f5648d78cacb0 (patch)
tree4312bb982fd96f2d8975e0841ef45bb2950e7e78 /drivers/staging/unisys/visorbus/visorchipset.c
parentstaging: unisys: visorbus: my_device_changestate add error handling (diff)
downloadkernel-qcow2-linux-e795491822c4c5bbb2c0d016676f5648d78cacb0.tar.gz
kernel-qcow2-linux-e795491822c4c5bbb2c0d016676f5648d78cacb0.tar.xz
kernel-qcow2-linux-e795491822c4c5bbb2c0d016676f5648d78cacb0.zip
staging: unisys: visorbus: my_device_destroy add error handling
Add the proper error handling to my_device_destroy so it can be send back up the stack for further error reporting. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David Kershner <david.kershner@unisys.com> Reviewed-by: David Binder <david.binder@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys/visorbus/visorchipset.c')
-rw-r--r--drivers/staging/unisys/visorbus/visorchipset.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 18f60f0c13ba..7cbf80318b5c 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1044,7 +1044,7 @@ err_respond:
return err;
}
-static void
+static int
my_device_destroy(struct controlvm_message *inmsg)
{
struct controlvm_message_packet *cmd = &inmsg->cmd;
@@ -1052,27 +1052,27 @@ my_device_destroy(struct controlvm_message *inmsg)
u32 bus_no = cmd->destroy_device.bus_no;
u32 dev_no = cmd->destroy_device.dev_no;
struct visor_device *dev_info;
- int rc = CONTROLVM_RESP_SUCCESS;
+ int err;
dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL);
if (!dev_info) {
- rc = -CONTROLVM_RESP_DEVICE_INVALID;
+ err = -ENODEV;
goto err_respond;
}
if (dev_info->state.created == 0) {
- rc = -CONTROLVM_RESP_ALREADY_DONE;
+ err = -EINVAL;
goto err_respond;
}
if (dev_info->pending_msg_hdr) {
/* only non-NULL if dev is still waiting on a response */
- rc = -CONTROLVM_RESP_ID_INVALID_FOR_CLIENT;
+ err = -EIO;
goto err_respond;
}
if (inmsg->hdr.flags.response_expected == 1) {
pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL);
if (!pmsg_hdr) {
- rc = -CONTROLVM_RESP_KMALLOC_FAILED;
+ err = -ENOMEM;
goto err_respond;
}
@@ -1082,11 +1082,12 @@ my_device_destroy(struct controlvm_message *inmsg)
}
chipset_device_destroy(dev_info);
- return;
+ return 0;
err_respond:
if (inmsg->hdr.flags.response_expected == 1)
- device_responder(inmsg->hdr.id, &inmsg->hdr, rc);
+ device_responder(inmsg->hdr.id, &inmsg->hdr, err);
+ return err;
}
/**