Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3aa2ec58 authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Greg Kroah-Hartman
Browse files

staging: unisys: uislib: uislib.c: sparse warning of context imbalance



fixed sparse warning : context imbalance in 'destroy_device'
                        unexpected unlock
this patch will generate warning from checkpatch for
lines over 80 character , but since those are user-visible strings
so it was not modified.

Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Tested-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Acked-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 635ecc5f
Loading
Loading
Loading
Loading
+58 −59
Original line number Diff line number Diff line
@@ -685,6 +685,7 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
	struct bus_info *bus;
	struct device_info *dev;
	struct guest_msgs cmd;
	int retval = CONTROLVM_RESP_SUCCESS;

	busNo = msg->cmd.destroyDevice.busNo;
	devNo = msg->cmd.destroyDevice.devNo;
@@ -697,18 +698,28 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
			if (devNo >= bus->deviceCount) {
				LOGERR("CONTROLVM_DEVICE_DESTORY Failed: device(%d) >= deviceCount(%d).",
				       devNo, bus->deviceCount);
				read_unlock(&BusListLock);
				return CONTROLVM_RESP_ERROR_DEVICE_INVALID;
			}
				retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
			} else {
				/* make sure this device exists */
				dev = bus->device[devNo];
				if (!dev) {
					LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device %d does not exist.",
					       devNo);
				read_unlock(&BusListLock);
				return CONTROLVM_RESP_ERROR_ALREADY_DONE;
					retval =
					     CONTROLVM_RESP_ERROR_ALREADY_DONE;
				}
			}
			break;
		}
	}

	if (!bus) {
		LOGERR("CONTROLVM_DEVICE_DESTROY Failed: bus %d does not exist",
		       busNo);
		retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
	}
	read_unlock(&BusListLock);
	if (retval == CONTROLVM_RESP_SUCCESS) {
		/* the msg is bound for virtpci; send
		 * guest_msgs struct to callback
		 */
@@ -716,8 +727,7 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
				 UltraVhbaChannelProtocolGuid)) {
			cmd.msgtype = GUEST_DEL_VHBA;
			cmd.del_vhba.chanptr = dev->chanptr;
			} else
			    if (!uuid_le_cmp(dev->channelTypeGuid,
		} else if (!uuid_le_cmp(dev->channelTypeGuid,
					UltraVnicChannelProtocolGuid)) {
			cmd.msgtype = GUEST_DEL_VNIC;
			cmd.del_vnic.chanptr = dev->chanptr;
@@ -726,16 +736,15 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
			return
			    CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
		}

		if (!VirtControlChanFunc) {
			LOGERR("CONTROLVM_DEVICE_DESTORY Failed: virtpci callback not registered.");
			return
			    CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
		}

		if (!VirtControlChanFunc(&cmd)) {
			LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci GUEST_DEL_[VHBA||VNIC] returned error.");
				return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
			return
			    CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
		}
/* you must disable channel interrupts BEFORE you unmap the channel,
 * because if you unmap first, there may still be some activity going
@@ -753,18 +762,8 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
		}
		kfree(dev);
		bus->device[devNo] = NULL;
			break;
		}
	}

	if (!bus) {
		LOGERR("CONTROLVM_DEVICE_DESTROY Failed: bus %d does not exist",
		       busNo);
		read_unlock(&BusListLock);
		return CONTROLVM_RESP_ERROR_BUS_INVALID;
	}

	return CONTROLVM_RESP_SUCCESS;
	return retval;
}

static int