diff options
author | David Kershner <david.kershner@unisys.com> | 2016-03-11 17:01:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-28 07:30:36 -0700 |
commit | 368acb3f512b415d11bfc3801b4a3d1453cc455d (patch) | |
tree | 1b814e0dc779c7b8ae3a11001033fe27c48882b9 /drivers/staging | |
parent | 9fd04060abdfd1e2ec763ea0096cc91026c77cca (diff) | |
download | linux-368acb3f512b415d11bfc3801b4a3d1453cc455d.tar.gz linux-368acb3f512b415d11bfc3801b4a3d1453cc455d.tar.bz2 linux-368acb3f512b415d11bfc3801b4a3d1453cc455d.zip |
staging: unisys: visorbus: Cleanup bus_epilog goto statements
Cleaned up bus_epilogs vague gotos and in the process discovered
some error paths that could unlock a non locked semaphore.
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Timothy Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/unisys/visorbus/visorchipset.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 49d99229d241..b1c5e9e78679 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -962,25 +962,29 @@ bus_epilog(struct visor_device *bus_info, bool notified = false; struct controlvm_message_header *pmsg_hdr = NULL; + down(¬ifier_lock); + if (!bus_info) { /* relying on a valid passed in response code */ /* be lazy and re-use msg_hdr for this failure, is this ok?? */ pmsg_hdr = msg_hdr; - goto away; + goto out_respond_and_unlock; } if (bus_info->pending_msg_hdr) { /* only non-NULL if dev is still waiting on a response */ response = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT; pmsg_hdr = bus_info->pending_msg_hdr; - goto away; + goto out_respond_and_unlock; } if (need_response) { pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL); if (!pmsg_hdr) { - response = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; - goto away; + POSTCODE_LINUX_4(MALLOC_FAILURE_PC, cmd, + bus_info->chipset_bus_no, + POSTCODE_SEVERITY_ERR); + goto out_unlock; } memcpy(pmsg_hdr, msg_hdr, @@ -988,7 +992,6 @@ bus_epilog(struct visor_device *bus_info, bus_info->pending_msg_hdr = pmsg_hdr; } - down(¬ifier_lock); if (response == CONTROLVM_RESP_SUCCESS) { switch (cmd) { case CONTROLVM_BUS_CREATE: @@ -1005,7 +1008,8 @@ bus_epilog(struct visor_device *bus_info, break; } } -away: + +out_respond_and_unlock: if (notified) /* The callback function just called above is responsible * for calling the appropriate visorchipset_busdev_responders @@ -1019,6 +1023,8 @@ away: * directly and kfree() there. */ bus_responder(cmd, pmsg_hdr, response); + +out_unlock: up(¬ifier_lock); } |