gpu: nvgpu: return error code in failure cases

In gk20a_ce_create_context(), if gk20a_tsg_open() or gk20a_open_new_channel()
fails, we bail out from the function without setting the error code
This could mislead the caller and report incorrect success

Fix this by setting error code explicitly in failure cases

Bug 200374011

Change-Id: Idf6cba4a57740107bada698295745352f7b5d5ac
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1631506
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2018-01-03 23:55:50 -08:00
committed by mobile promotions
parent 5ad1c28b5f
commit c7b7dbe39a

View File

@@ -457,9 +457,9 @@ u32 gk20a_ce_create_context(struct gk20a *g,
/* allocate a tsg if needed */
ce_ctx->tsg = gk20a_tsg_open(g);
if (!ce_ctx->tsg) {
nvgpu_err(g, "ce: gk20a tsg not available");
err = -ENOMEM;
goto end;
}
@@ -467,6 +467,7 @@ u32 gk20a_ce_create_context(struct gk20a *g,
ce_ctx->ch = gk20a_open_new_channel(g, runlist_id, true);
if (!ce_ctx->ch) {
nvgpu_err(g, "ce: gk20a channel not available");
err = -ENOMEM;
goto end;
}
ce_ctx->ch->wdt_enabled = false;