* @param x the value to return
*/
#define RETINT(x) do { rc = (x); RETTRACE(x); goto Away; } while (0)
-/** return from a void* function, using a common exit point "Away"
- * @param x the value to return
- */
-#define RETPTR(x) do { rc = (x); RETTRACE(x); goto Away; } while (0)
/** Given a typedef/struct/union and a member field name,
* return the number of bytes occupied by that field.
* @param TYPE the typedef name, or "struct xx" or "union xx"
LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
(unsigned long long) channelAddr,
(unsigned long long) channelBytes);
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
if (isServer) {
memset_io(pChan, 0, channelBytes);
if (!ULTRA_VBUS_CHANNEL_OK_SERVER(channelBytes, NULL)) {
ERRDRV("%s channel cannot be used", __func__);
uislib_iounmap(pChan);
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
ULTRA_VBUS_init_channel(pChan, channelBytes);
} else {
if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) {
ERRDRV("%s channel cannot be used", __func__);
uislib_iounmap(pChan);
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
}
- RETPTR(pChan);
+ rc = pChan;
Away:
return rc;
}
#define RETVOID do { goto Away; } while (0)
#define RETINT(x) do { rc = (x); goto Away; } while (0)
-#define RETPTR(x) do { rc = (x); goto Away; } while (0)
#define CHECK_CACHE_ALIGN 0
p->size = channelBytes;
p->guid = guid;
- RETPTR(p);
-
+ rc = p;
Away:
if (rc == NULL) {
MAX_CONTROLVM_PAYLOAD_BYTES);
if (tryAgain)
*tryAgain = TRUE;
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY);
if (ctx == NULL) {
__func__, __FILE__, __LINE__, allocbytes);
if (tryAgain)
*tryAgain = TRUE;
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
ctx->allocbytes = allocbytes;
ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)",
__func__,
(unsigned long long) addr, (ulong) bytes);
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
p = __va((ulong) (addr));
memcpy(ctx->data, p, bytes);
} else {
rgn = visor_memregion_create(addr, bytes);
- if (!rgn)
- RETPTR(NULL);
- if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0)
- RETPTR(NULL);
+ if (!rgn) {
+ rc = NULL;
+ goto Away;
+ }
+ if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) {
+ rc = NULL;
+ goto Away;
+ }
}
if (!hasStandardPayloadHeader) {
ctx->byte_stream = TRUE;
- RETPTR(ctx);
+ rc = ctx;
+ goto Away;
}
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
if (phdr->TotalLength != bytes) {
ERRDRV("%s - bad total length %lu (should be %lu)",
__func__,
(ulong) (phdr->TotalLength), (ulong) (bytes));
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
if (phdr->TotalLength < phdr->HeaderLength) {
ERRDRV("%s - total length < header length (%lu < %lu)",
__func__,
(ulong) (phdr->TotalLength),
(ulong) (phdr->HeaderLength));
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
if (phdr->HeaderLength < sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)) {
ERRDRV("%s - header is too small (%lu < %lu)",
__func__,
(ulong) (phdr->HeaderLength),
(ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)));
- RETPTR(NULL);
+ rc = NULL;
+ goto Away;
}
- RETPTR(ctx);
-
+ rc = ctx;
Away:
if (rgn) {
visor_memregion_destroy(rgn);
memregion->physaddr = physaddr;
memregion->nbytes = nbytes;
memregion->overlapped = FALSE;
- if (!mapit(memregion))
- RETPTR(NULL);
- RETPTR(memregion);
-
+ if (!mapit(memregion)) {
+ rc = NULL;
+ goto Away;
+ }
+ rc = memregion;
Away:
if (rc == NULL) {
if (memregion != NULL) {
parent = procDirRoot;
for (i = 0; i < type->nNames; i++) {
type->procDirs[i] = createProcDir(type->name[i], parent);
- if (type->procDirs[i] == NULL)
- RETPTR(NULL);
+ if (type->procDirs[i] == NULL) {
+ rc = NULL;
+ goto Away;
+ }
parent = type->procDirs[i];
}
type->procDir = type->procDirs[type->nNames-1];
- RETPTR(type);
+ rc = type;
Away:
if (rc == NULL) {
if (type != NULL) {
}
strcpy(obj->name, name);
obj->procDir = createProcDir(obj->name, type->procDir);
- if (obj->procDir == NULL)
- RETPTR(NULL);
+ if (obj->procDir == NULL) {
+ rc = NULL;
+ goto Away;
+ }
}
obj->procDirPropertyContexts =
kzalloc((type->nProperties + 1) * sizeof(PROCDIRENTRYCONTEXT),
createProcFile(type->propertyNames[i],
obj->procDir, &proc_fops,
&obj->procDirPropertyContexts[i]);
- if (obj->procDirProperties[i] == NULL)
- RETPTR(NULL);
+ if (obj->procDirProperties[i] == NULL) {
+ rc = NULL;
+ goto Away;
+ }
}
}
- RETPTR(obj);
+ rc = obj;
Away:
if (rc == NULL) {
if (obj != NULL) {
struct seq_file *rc = NULL;
struct seq_file *m = kmalloc_kernel(sizeof(struct seq_file));
- if (m == NULL)
- RETPTR(NULL);
+ if (m == NULL) {
+ rc = NULL;
+ goto Away;
+ }
memset(m, 0, sizeof(struct seq_file));
m->buf = buf;
m->size = buf_size;
- RETPTR(m);
+ rc = m;
Away:
if (rc == NULL) {
visor_seq_file_done_buffer(m);