mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-19 03:37:55 +00:00
staging: unisys: visorbus: cleanup gotos in parser_init_byte_stream
Clean up the goto in parser_init_byte_stream and make the goto section the error case. 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>
This commit is contained in:
parent
dde29996cd
commit
d79f56b599
@ -359,8 +359,7 @@ static struct parser_context *
|
|||||||
parser_init_byte_stream(u64 addr, u32 bytes, bool local, bool *retry)
|
parser_init_byte_stream(u64 addr, u32 bytes, bool local, bool *retry)
|
||||||
{
|
{
|
||||||
int allocbytes = sizeof(struct parser_context) + bytes;
|
int allocbytes = sizeof(struct parser_context) + bytes;
|
||||||
struct parser_context *rc = NULL;
|
struct parser_context *ctx;
|
||||||
struct parser_context *ctx = NULL;
|
|
||||||
|
|
||||||
if (retry)
|
if (retry)
|
||||||
*retry = false;
|
*retry = false;
|
||||||
@ -374,15 +373,13 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, bool *retry)
|
|||||||
> MAX_CONTROLVM_PAYLOAD_BYTES) {
|
> MAX_CONTROLVM_PAYLOAD_BYTES) {
|
||||||
if (retry)
|
if (retry)
|
||||||
*retry = true;
|
*retry = true;
|
||||||
rc = NULL;
|
return NULL;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
ctx = kzalloc(allocbytes, GFP_KERNEL | __GFP_NORETRY);
|
ctx = kzalloc(allocbytes, GFP_KERNEL | __GFP_NORETRY);
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
if (retry)
|
if (retry)
|
||||||
*retry = true;
|
*retry = true;
|
||||||
rc = NULL;
|
return NULL;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->allocbytes = allocbytes;
|
ctx->allocbytes = allocbytes;
|
||||||
@ -393,35 +390,27 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, bool *retry)
|
|||||||
if (local) {
|
if (local) {
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
if (addr > virt_to_phys(high_memory - 1)) {
|
if (addr > virt_to_phys(high_memory - 1))
|
||||||
rc = NULL;
|
goto err_finish_ctx;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
p = __va((unsigned long)(addr));
|
p = __va((unsigned long)(addr));
|
||||||
memcpy(ctx->data, p, bytes);
|
memcpy(ctx->data, p, bytes);
|
||||||
} else {
|
} else {
|
||||||
void *mapping = memremap(addr, bytes, MEMREMAP_WB);
|
void *mapping = memremap(addr, bytes, MEMREMAP_WB);
|
||||||
|
|
||||||
if (!mapping) {
|
if (!mapping)
|
||||||
rc = NULL;
|
goto err_finish_ctx;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
memcpy(ctx->data, mapping, bytes);
|
memcpy(ctx->data, mapping, bytes);
|
||||||
memunmap(mapping);
|
memunmap(mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->byte_stream = true;
|
ctx->byte_stream = true;
|
||||||
rc = ctx;
|
controlvm_payload_bytes_buffered += ctx->param_bytes;
|
||||||
cleanup:
|
|
||||||
if (rc) {
|
return ctx;
|
||||||
controlvm_payload_bytes_buffered += ctx->param_bytes;
|
|
||||||
} else {
|
err_finish_ctx:
|
||||||
if (ctx) {
|
parser_done(ctx);
|
||||||
parser_done(ctx);
|
return NULL;
|
||||||
ctx = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uuid_le
|
static uuid_le
|
||||||
|
Loading…
x
Reference in New Issue
Block a user