if (alloc_chrdev_region(&MajorDev, 0, 1, MYDRVNAME) < 0) {
ERRDRV("Unable to allocate+register char device %s",
MYDRVNAME);
- RETINT(-1);
+ goto Away;
}
Registered = TRUE;
INFODRV("New major number %d registered\n", MAJOR(MajorDev));
/* static major device number registration required */
if (register_chrdev_region(MajorDev, 1, MYDRVNAME) < 0) {
ERRDRV("Unable to register char device %s", MYDRVNAME);
- RETINT(-1);
+ goto Away;
}
Registered = TRUE;
INFODRV("Static major number %d registered\n", MAJOR(MajorDev));
}
if (cdev_add(&Cdev, MKDEV(MAJOR(MajorDev), 0), 1) < 0) {
- ERRDRV("failed to create char device: (status=-1)\n");
- rc = -1;
+ ERRDRV("failed to create char device: (status=%d)\n", rc);
goto Away;
}
INFODRV("Registered char device for %s (major=%d)",
MYDRVNAME, MAJOR(MajorDev));
- RETINT(0);
+ rc = 0;
Away:
return rc;
}
DEBUGDRV("%s", __func__);
if (minor_number != 0)
- RETINT(-ENODEV);
+ goto Away;
file->private_data = NULL;
- RETINT(0);
+ rc = 0;
Away:
if (rc < 0)
ERRDRV("%s minor=%d failed", __func__, minor_number);
static int
visorchipset_release(struct inode *inode, struct file *file)
{
- int rc = -1;
DEBUGDRV("%s", __func__);
- RETINT(0);
-Away:
- return rc;
+ return 0;
}
static int
/* get the physical rtc offset */
vrtc_offset = Issue_VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET();
if (copy_to_user
- ((void __user *)arg, &vrtc_offset, sizeof(vrtc_offset)))
- RETINT(-EFAULT);
+ ((void __user *)arg, &vrtc_offset, sizeof(vrtc_offset))) {
+ rc = -EFAULT;
+ goto Away;
+ }
DBGINF("insde visorchipset_ioctl, cmd=%d, vrtc_offset=%lld",
cmd, vrtc_offset);
break;
case VMCALL_UPDATE_PHYSICAL_TIME:
if (copy_from_user
- (&adjustment, (void __user *)arg, sizeof(adjustment)))
- RETINT(-EFAULT);
+ (&adjustment, (void __user *)arg, sizeof(adjustment))) {
+ rc = -EFAULT;
+ goto Away;
+ }
DBGINF("insde visorchipset_ioctl, cmd=%d, adjustment=%lld", cmd,
adjustment);
rc = Issue_VMCALL_UPDATE_PHYSICAL_TIME(adjustment);
break;
default:
LOGERR("visorchipset_ioctl received invalid command");
- RETINT(-EFAULT);
+ rc = -EFAULT;
break;
}
- RETINT(rc);
Away:
DBGINF("exiting %d!", rc);
return rc;
POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO);
if (chipset_inited) {
LOGERR("CONTROLVM_CHIPSET_INIT Failed: Already Done.");
- RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE);
+ rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
+ goto Away;
}
chipset_inited = 1;
POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO);
busNo);
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE);
+ rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
+ goto Away;
}
pBusInfo = kzalloc(sizeof(VISORCHIPSET_BUS_INFO), GFP_KERNEL);
if (pBusInfo == NULL) {
busNo);
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED);
+ rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
+ goto Away;
}
INIT_LIST_HEAD(&pBusInfo->entry);
pBusInfo = findbus(&BusInfoList, busNo);
if (!pBusInfo) {
LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu invalid", busNo);
- RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
+ goto Away;
}
if (pBusInfo->state.created == 0) {
LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu already destroyed",
busNo);
- RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE);
+ rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
+ goto Away;
}
Away:
busNo);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
+ goto Away;
}
if (pBusInfo->state.created == 0) {
LOGERR("CONTROLVM_BUS_CONFIGURE Failed: Invalid bus %lu - not created yet",
busNo);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
+ goto Away;
}
/* TBD - add this check to other commands also... */
if (pBusInfo->pendingMsgHdr.Id != CONTROLVM_INVALID) {
busNo, (uint) pBusInfo->pendingMsgHdr.Id);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT);
+ rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
+ goto Away;
}
pBusInfo->partitionHandle = cmd->configureBus.guestHandle;
busNo);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED);
+ rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
+ goto Away;
}
POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO);
Away:
busNo, devNo);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE);
+ rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
+ goto Away;
}
pBusInfo = findbus(&BusInfoList, busNo);
if (!pBusInfo) {
busNo);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
+ goto Away;
}
if (pBusInfo->state.created == 0) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - not created yet",
busNo);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
+ goto Away;
}
pDevInfo = kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL);
if (pDevInfo == NULL) {
busNo, devNo);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED);
+ rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
+ goto Away;
}
INIT_LIST_HEAD(&pDevInfo->entry);
busNo, devNo);
POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_DEVICE_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
+ goto Away;
}
if (pDevInfo->state.created == 0) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (not created)",
busNo, devNo);
POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
- RETINT(-CONTROLVM_RESP_ERROR_DEVICE_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
}
Away:
if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo)
if (!pDevInfo) {
LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu invalid",
busNo, devNo);
- RETINT(-CONTROLVM_RESP_ERROR_DEVICE_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
+ goto Away;
}
if (pDevInfo->state.created == 0) {
LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu already destroyed",
busNo, devNo);
- RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE);
+ rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
Away:
if (info == NULL) {
LOGERR("HUH ? CONTROLVM_PAYLOAD_INIT Failed : Programmer check at %s:%d",
__FILE__, __LINE__);
- RETINT(-CONTROLVM_RESP_ERROR_PAYLOAD_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID;
+ goto Away;
}
memset(info, 0, sizeof(CONTROLVM_PAYLOAD_INFO));
if ((offset == 0) || (bytes == 0)) {
LOGERR("CONTROLVM_PAYLOAD_INIT Failed: RequestPayloadOffset=%llu RequestPayloadBytes=%llu!",
(u64) offset, (u64) bytes);
- RETINT(-CONTROLVM_RESP_ERROR_PAYLOAD_INVALID);
+ rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID;
+ goto Away;
}
payload = ioremap_cache(phys_addr + offset, bytes);
if (payload == NULL) {
LOGERR("CONTROLVM_PAYLOAD_INIT Failed: ioremap_cache %llu for %llu bytes failed",
(u64) offset, (u64) bytes);
- RETINT(-CONTROLVM_RESP_ERROR_IOREMAP_FAILED);
+ rc = -CONTROLVM_RESP_ERROR_IOREMAP_FAILED;
+ goto Away;
}
info->offset = offset;
}
LOGINF("visorchipset device created");
POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC, POSTCODE_SEVERITY_INFO);
- RETINT(0);
-
+ rc = 0;
Away:
-
if (rc) {
LOGERR("visorchipset_init failed");
POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc,