diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2015-05-05 18:36:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-08 15:26:03 +0200 |
commit | 712c03dcab8ee2ff82b280a517ba4f0adc9a54b5 (patch) | |
tree | 32f8363e015e581964515cb1941ed35c6542c506 /drivers/staging | |
parent | 75d1e6613c3ae4728c0ff15e23ab4226e8dfbfcf (diff) |
staging: unisys: visorchipset: parser_init_guts(): Localize memregion usage
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/unisys/visorbus/visorchipset.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 5bf8266f0663..2be8514d7b18 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -399,6 +399,7 @@ parser_init_guts(u64 addr, u32 bytes, bool local, struct parser_context *ctx = NULL; struct memregion *rgn = NULL; struct spar_controlvm_parameters_header *phdr = NULL; + int cnt; if (retry) *retry = false; @@ -442,7 +443,10 @@ parser_init_guts(u64 addr, u32 bytes, bool local, rc = NULL; goto cleanup; } - if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) { + cnt = visor_memregion_read(rgn, 0, ctx->data, bytes); + visor_memregion_destroy(rgn); + + if (cnt < 0) { rc = NULL; goto cleanup; } @@ -469,10 +473,6 @@ parser_init_guts(u64 addr, u32 bytes, bool local, rc = ctx; cleanup: - if (rgn) { - visor_memregion_destroy(rgn); - rgn = NULL; - } if (rc) { controlvm_payload_bytes_buffered += ctx->param_bytes; } else { |