mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-08 18:42:53 +00:00
Staging: unisys: Remove RETPTR macro
The RETPTR macro contained a goto statement which is not allowed in the kernel. Signed-off-by: Ken Cox <jkc@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
61e03b433d
commit
d9355f8934
@ -128,10 +128,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */
|
|||||||
* @param x the value to return
|
* @param x the value to return
|
||||||
*/
|
*/
|
||||||
#define RETINT(x) do { rc = (x); RETTRACE(x); goto Away; } while (0)
|
#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,
|
/** Given a typedef/struct/union and a member field name,
|
||||||
* return the number of bytes occupied by that field.
|
* return the number of bytes occupied by that field.
|
||||||
* @param TYPE the typedef name, or "struct xx" or "union xx"
|
* @param TYPE the typedef name, or "struct xx" or "union xx"
|
||||||
|
@ -270,24 +270,27 @@ init_vbus_channel(U64 channelAddr, U32 channelBytes, int isServer)
|
|||||||
LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
|
LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
|
||||||
(unsigned long long) channelAddr,
|
(unsigned long long) channelAddr,
|
||||||
(unsigned long long) channelBytes);
|
(unsigned long long) channelBytes);
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
if (isServer) {
|
if (isServer) {
|
||||||
memset_io(pChan, 0, channelBytes);
|
memset_io(pChan, 0, channelBytes);
|
||||||
if (!ULTRA_VBUS_CHANNEL_OK_SERVER(channelBytes, NULL)) {
|
if (!ULTRA_VBUS_CHANNEL_OK_SERVER(channelBytes, NULL)) {
|
||||||
ERRDRV("%s channel cannot be used", __func__);
|
ERRDRV("%s channel cannot be used", __func__);
|
||||||
uislib_iounmap(pChan);
|
uislib_iounmap(pChan);
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
ULTRA_VBUS_init_channel(pChan, channelBytes);
|
ULTRA_VBUS_init_channel(pChan, channelBytes);
|
||||||
} else {
|
} else {
|
||||||
if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) {
|
if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) {
|
||||||
ERRDRV("%s channel cannot be used", __func__);
|
ERRDRV("%s channel cannot be used", __func__);
|
||||||
uislib_iounmap(pChan);
|
uislib_iounmap(pChan);
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RETPTR(pChan);
|
rc = pChan;
|
||||||
Away:
|
Away:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#define RETVOID do { goto Away; } while (0)
|
#define RETVOID do { goto Away; } while (0)
|
||||||
#define RETINT(x) do { rc = (x); 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
|
#define CHECK_CACHE_ALIGN 0
|
||||||
|
|
||||||
|
@ -89,8 +89,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes,
|
|||||||
p->size = channelBytes;
|
p->size = channelBytes;
|
||||||
p->guid = guid;
|
p->guid = guid;
|
||||||
|
|
||||||
RETPTR(p);
|
rc = p;
|
||||||
|
|
||||||
Away:
|
Away:
|
||||||
|
|
||||||
if (rc == NULL) {
|
if (rc == NULL) {
|
||||||
|
@ -63,7 +63,8 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal,
|
|||||||
MAX_CONTROLVM_PAYLOAD_BYTES);
|
MAX_CONTROLVM_PAYLOAD_BYTES);
|
||||||
if (tryAgain)
|
if (tryAgain)
|
||||||
*tryAgain = TRUE;
|
*tryAgain = TRUE;
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY);
|
ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY);
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
@ -71,7 +72,8 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal,
|
|||||||
__func__, __FILE__, __LINE__, allocbytes);
|
__func__, __FILE__, __LINE__, allocbytes);
|
||||||
if (tryAgain)
|
if (tryAgain)
|
||||||
*tryAgain = TRUE;
|
*tryAgain = TRUE;
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->allocbytes = allocbytes;
|
ctx->allocbytes = allocbytes;
|
||||||
@ -85,45 +87,53 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal,
|
|||||||
ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)",
|
ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)",
|
||||||
__func__,
|
__func__,
|
||||||
(unsigned long long) addr, (ulong) bytes);
|
(unsigned long long) addr, (ulong) bytes);
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
p = __va((ulong) (addr));
|
p = __va((ulong) (addr));
|
||||||
memcpy(ctx->data, p, bytes);
|
memcpy(ctx->data, p, bytes);
|
||||||
} else {
|
} else {
|
||||||
rgn = visor_memregion_create(addr, bytes);
|
rgn = visor_memregion_create(addr, bytes);
|
||||||
if (!rgn)
|
if (!rgn) {
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0)
|
goto Away;
|
||||||
RETPTR(NULL);
|
}
|
||||||
|
if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) {
|
||||||
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!hasStandardPayloadHeader) {
|
if (!hasStandardPayloadHeader) {
|
||||||
ctx->byte_stream = TRUE;
|
ctx->byte_stream = TRUE;
|
||||||
RETPTR(ctx);
|
rc = ctx;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data);
|
||||||
if (phdr->TotalLength != bytes) {
|
if (phdr->TotalLength != bytes) {
|
||||||
ERRDRV("%s - bad total length %lu (should be %lu)",
|
ERRDRV("%s - bad total length %lu (should be %lu)",
|
||||||
__func__,
|
__func__,
|
||||||
(ulong) (phdr->TotalLength), (ulong) (bytes));
|
(ulong) (phdr->TotalLength), (ulong) (bytes));
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
if (phdr->TotalLength < phdr->HeaderLength) {
|
if (phdr->TotalLength < phdr->HeaderLength) {
|
||||||
ERRDRV("%s - total length < header length (%lu < %lu)",
|
ERRDRV("%s - total length < header length (%lu < %lu)",
|
||||||
__func__,
|
__func__,
|
||||||
(ulong) (phdr->TotalLength),
|
(ulong) (phdr->TotalLength),
|
||||||
(ulong) (phdr->HeaderLength));
|
(ulong) (phdr->HeaderLength));
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
if (phdr->HeaderLength < sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)) {
|
if (phdr->HeaderLength < sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)) {
|
||||||
ERRDRV("%s - header is too small (%lu < %lu)",
|
ERRDRV("%s - header is too small (%lu < %lu)",
|
||||||
__func__,
|
__func__,
|
||||||
(ulong) (phdr->HeaderLength),
|
(ulong) (phdr->HeaderLength),
|
||||||
(ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)));
|
(ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)));
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETPTR(ctx);
|
rc = ctx;
|
||||||
|
|
||||||
Away:
|
Away:
|
||||||
if (rgn) {
|
if (rgn) {
|
||||||
visor_memregion_destroy(rgn);
|
visor_memregion_destroy(rgn);
|
||||||
|
@ -50,10 +50,11 @@ visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes)
|
|||||||
memregion->physaddr = physaddr;
|
memregion->physaddr = physaddr;
|
||||||
memregion->nbytes = nbytes;
|
memregion->nbytes = nbytes;
|
||||||
memregion->overlapped = FALSE;
|
memregion->overlapped = FALSE;
|
||||||
if (!mapit(memregion))
|
if (!mapit(memregion)) {
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
RETPTR(memregion);
|
goto Away;
|
||||||
|
}
|
||||||
|
rc = memregion;
|
||||||
Away:
|
Away:
|
||||||
if (rc == NULL) {
|
if (rc == NULL) {
|
||||||
if (memregion != NULL) {
|
if (memregion != NULL) {
|
||||||
|
@ -162,12 +162,14 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot,
|
|||||||
parent = procDirRoot;
|
parent = procDirRoot;
|
||||||
for (i = 0; i < type->nNames; i++) {
|
for (i = 0; i < type->nNames; i++) {
|
||||||
type->procDirs[i] = createProcDir(type->name[i], parent);
|
type->procDirs[i] = createProcDir(type->name[i], parent);
|
||||||
if (type->procDirs[i] == NULL)
|
if (type->procDirs[i] == NULL) {
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
|
}
|
||||||
parent = type->procDirs[i];
|
parent = type->procDirs[i];
|
||||||
}
|
}
|
||||||
type->procDir = type->procDirs[type->nNames-1];
|
type->procDir = type->procDirs[type->nNames-1];
|
||||||
RETPTR(type);
|
rc = type;
|
||||||
Away:
|
Away:
|
||||||
if (rc == NULL) {
|
if (rc == NULL) {
|
||||||
if (type != NULL) {
|
if (type != NULL) {
|
||||||
@ -232,8 +234,10 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type,
|
|||||||
}
|
}
|
||||||
strcpy(obj->name, name);
|
strcpy(obj->name, name);
|
||||||
obj->procDir = createProcDir(obj->name, type->procDir);
|
obj->procDir = createProcDir(obj->name, type->procDir);
|
||||||
if (obj->procDir == NULL)
|
if (obj->procDir == NULL) {
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
obj->procDirPropertyContexts =
|
obj->procDirPropertyContexts =
|
||||||
kzalloc((type->nProperties + 1) * sizeof(PROCDIRENTRYCONTEXT),
|
kzalloc((type->nProperties + 1) * sizeof(PROCDIRENTRYCONTEXT),
|
||||||
@ -256,11 +260,13 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type,
|
|||||||
createProcFile(type->propertyNames[i],
|
createProcFile(type->propertyNames[i],
|
||||||
obj->procDir, &proc_fops,
|
obj->procDir, &proc_fops,
|
||||||
&obj->procDirPropertyContexts[i]);
|
&obj->procDirPropertyContexts[i]);
|
||||||
if (obj->procDirProperties[i] == NULL)
|
if (obj->procDirProperties[i] == NULL) {
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RETPTR(obj);
|
rc = obj;
|
||||||
Away:
|
Away:
|
||||||
if (rc == NULL) {
|
if (rc == NULL) {
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
|
@ -43,12 +43,14 @@ struct seq_file *visor_seq_file_new_buffer(void *buf, size_t buf_size)
|
|||||||
struct seq_file *rc = NULL;
|
struct seq_file *rc = NULL;
|
||||||
struct seq_file *m = kmalloc_kernel(sizeof(struct seq_file));
|
struct seq_file *m = kmalloc_kernel(sizeof(struct seq_file));
|
||||||
|
|
||||||
if (m == NULL)
|
if (m == NULL) {
|
||||||
RETPTR(NULL);
|
rc = NULL;
|
||||||
|
goto Away;
|
||||||
|
}
|
||||||
memset(m, 0, sizeof(struct seq_file));
|
memset(m, 0, sizeof(struct seq_file));
|
||||||
m->buf = buf;
|
m->buf = buf;
|
||||||
m->size = buf_size;
|
m->size = buf_size;
|
||||||
RETPTR(m);
|
rc = m;
|
||||||
Away:
|
Away:
|
||||||
if (rc == NULL) {
|
if (rc == NULL) {
|
||||||
visor_seq_file_done_buffer(m);
|
visor_seq_file_done_buffer(m);
|
||||||
|
Loading…
Reference in New Issue
Block a user