summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2018-01-04 02:55:50 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-04 11:46:07 -0500
commitc7b7dbe39a598aa228e4aaea4aec3ce958a27187 (patch)
tree6bbbccf71e55a22064e1b477ea02762b681af8a1 /drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
parent5ad1c28b5fa7724e7aa65ea1a87a615c0d5408f6 (diff)
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>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/ce2_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ce2_gk20a.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
index 99a6dd1b..fd298bbf 100644
--- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
@@ -457,9 +457,9 @@ u32 gk20a_ce_create_context(struct gk20a *g,
457 457
458 /* allocate a tsg if needed */ 458 /* allocate a tsg if needed */
459 ce_ctx->tsg = gk20a_tsg_open(g); 459 ce_ctx->tsg = gk20a_tsg_open(g);
460
461 if (!ce_ctx->tsg) { 460 if (!ce_ctx->tsg) {
462 nvgpu_err(g, "ce: gk20a tsg not available"); 461 nvgpu_err(g, "ce: gk20a tsg not available");
462 err = -ENOMEM;
463 goto end; 463 goto end;
464 } 464 }
465 465
@@ -467,6 +467,7 @@ u32 gk20a_ce_create_context(struct gk20a *g,
467 ce_ctx->ch = gk20a_open_new_channel(g, runlist_id, true); 467 ce_ctx->ch = gk20a_open_new_channel(g, runlist_id, true);
468 if (!ce_ctx->ch) { 468 if (!ce_ctx->ch) {
469 nvgpu_err(g, "ce: gk20a channel not available"); 469 nvgpu_err(g, "ce: gk20a channel not available");
470 err = -ENOMEM;
470 goto end; 471 goto end;
471 } 472 }
472 ce_ctx->ch->wdt_enabled = false; 473 ce_ctx->ch->wdt_enabled = false;