summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorbus/visorchipset.c
diff options
context:
space:
mode:
authorDavid Kershner2016-11-03 16:44:21 +0100
committerGreg Kroah-Hartman2016-11-07 10:56:39 +0100
commit30f6c3f5ff358977d483014af24cbc913dafa6d0 (patch)
tree57eaca971f22a35245c8b50856dab1f9c5a192a6 /drivers/staging/unisys/visorbus/visorchipset.c
parentstaging: unisys: visorbus: bus_destroy do not call bus_epilog (diff)
downloadkernel-qcow2-linux-30f6c3f5ff358977d483014af24cbc913dafa6d0.tar.gz
kernel-qcow2-linux-30f6c3f5ff358977d483014af24cbc913dafa6d0.tar.xz
kernel-qcow2-linux-30f6c3f5ff358977d483014af24cbc913dafa6d0.zip
staging: unisys: visorbus: bus_destroy add error handling
Do proper error handling and return error codes instead of just ignoring them. Signed-off-by: David Kershner <david.kershner@unisys.com> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Tim Sell <Timothy.Sell@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.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index fa1db9dfdc1d..17559414c1c6 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -732,10 +732,6 @@ bus_epilog(struct visor_device *bus_info,
/* chipset_bus_create is responsible to respond */
chipset_bus_create(bus_info);
break;
- case CONTROLVM_BUS_DESTROY:
- /* chipset_bus_destroy is responsible to respond */
- chipset_bus_destroy(bus_info);
- break;
default:
goto out_respond;
}
@@ -898,28 +894,28 @@ out_bus_epilog:
bus_responder(CONTROLVM_BUS_CREATE, &inmsg->hdr, rc);
}
-static void
+static int
bus_destroy(struct controlvm_message *inmsg)
{
struct controlvm_message_packet *cmd = &inmsg->cmd;
struct controlvm_message_header *pmsg_hdr = NULL;
u32 bus_no = cmd->destroy_bus.bus_no;
struct visor_device *bus_info;
- int rc = CONTROLVM_RESP_SUCCESS;
+ int err;
bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL);
if (!bus_info) {
- rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
- goto out_respond;
+ err = -ENODEV;
+ goto err_respond;
}
if (bus_info->state.created == 0) {
- rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
- goto out_respond;
+ err = -ENOENT;
+ goto err_respond;
}
if (bus_info->pending_msg_hdr) {
/* only non-NULL if dev is still waiting on a response */
- rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
- goto out_respond;
+ err = -EEXIST;
+ goto err_respond;
}
if (inmsg->hdr.flags.response_expected == 1) {
pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL);
@@ -927,8 +923,8 @@ bus_destroy(struct controlvm_message *inmsg)
POSTCODE_LINUX_4(MALLOC_FAILURE_PC, cmd,
bus_info->chipset_bus_no,
POSTCODE_SEVERITY_ERR);
- rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
- goto out_respond;
+ err = -ENOMEM;
+ goto err_respond;
}
memcpy(pmsg_hdr, &inmsg->hdr,
@@ -938,13 +934,12 @@ bus_destroy(struct controlvm_message *inmsg)
/* Response will be handled by chipset_bus_destroy */
chipset_bus_destroy(bus_info);
- return;
+ return 0;
-out_respond:
+err_respond:
if (inmsg->hdr.flags.response_expected == 1)
- bus_responder(inmsg->hdr.id, &inmsg->hdr, rc);
-
- /* bus_info is freed as part of the busdevice_release function */
+ bus_responder(inmsg->hdr.id, &inmsg->hdr, err);
+ return err;
}
static void