gpu: nvgpu: remove unnecessary asserts in obj_ctx subunit

Below functions in common.gr.obj_ctx subunit include unnecessary
asserts to ensure value is not truncated when parsing into U32 size.
nvgpu_gr_obj_ctx_gr_ctx_alloc()

Make use of nvgpu_safe_cast_u64_to_u32() and remove unnecessary
asserts

Jira NVGPU-4778

Change-Id: Ic06c2f4131b3bba35222f7de5441f82ecee6d83d
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2277158
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2020-01-09 17:15:35 +05:30
committed by Alex Waterman
parent 04285893f7
commit c96164ede4

View File

@@ -728,8 +728,8 @@ static int nvgpu_gr_obj_ctx_gr_ctx_alloc(struct gk20a *g,
nvgpu_log_fn(g, " ");
size = nvgpu_gr_obj_ctx_get_golden_image_size(golden_image);
nvgpu_assert(size <= U64(U32_MAX));
nvgpu_gr_ctx_set_size(gr_ctx_desc, NVGPU_GR_CTX_CTX, U32(size));
nvgpu_gr_ctx_set_size(gr_ctx_desc, NVGPU_GR_CTX_CTX,
nvgpu_safe_cast_u64_to_u32(size));
err = nvgpu_gr_ctx_alloc(g, gr_ctx, gr_ctx_desc, vm);
if (err != 0) {