gpu: nvgpu: vgpu: fix error handling for mempool reserve failure

Bug 1648908
Bug 200183294

Change-Id: Iccf5eb762a544e423050d223bfcb6f8a53af6350
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: http://git-master/r/1113040
Reviewed-on: http://git-master/r/1121262
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Richard Zhao
2016-03-18 15:02:37 -07:00
committed by Terje Bergstrom
parent 60b715e856
commit c8c376b22a

View File

@@ -62,6 +62,11 @@ static int vgpu_fecs_trace_init(struct gk20a *g)
} }
vcst->buf = ioremap_cache(vcst->cookie->ipa, vcst->cookie->size); vcst->buf = ioremap_cache(vcst->cookie->ipa, vcst->cookie->size);
if (!vcst->buf) {
dev_info(dev_from_gk20a(g), "ioremap_cache failed\n");
err = -EINVAL;
goto fail;
}
vcst->header = vcst->buf; vcst->header = vcst->buf;
vcst->num_entries = vcst->header->num_ents; vcst->num_entries = vcst->header->num_ents;
if (unlikely(vcst->header->ent_size != sizeof(*vcst->entries))) { if (unlikely(vcst->header->ent_size != sizeof(*vcst->entries))) {
@@ -75,7 +80,7 @@ static int vgpu_fecs_trace_init(struct gk20a *g)
return 0; return 0;
fail: fail:
iounmap(vcst->buf); iounmap(vcst->buf);
if (vcst->cookie) if (!IS_ERR(vcst->cookie))
tegra_hv_mempool_unreserve(vcst->cookie); tegra_hv_mempool_unreserve(vcst->cookie);
kfree(vcst); kfree(vcst);
return err; return err;