diff --git a/drivers/gpu/nvgpu/hal/bus/bus_gm20b_fusa.c b/drivers/gpu/nvgpu/hal/bus/bus_gm20b_fusa.c index 5a32d2b41..9a51a38c2 100644 --- a/drivers/gpu/nvgpu/hal/bus/bus_gm20b_fusa.c +++ b/drivers/gpu/nvgpu/hal/bus/bus_gm20b_fusa.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "bus_gm20b.h" @@ -37,7 +38,8 @@ int gm20b_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst) struct nvgpu_timeout timeout; int err = 0; u64 iova = nvgpu_inst_block_addr(g, bar1_inst); - u32 ptr_v = (u32)(iova >> bus_bar1_block_ptr_shift_v()); + u32 ptr_v = nvgpu_safe_cast_u64_to_u32(iova + >> bus_bar1_block_ptr_shift_v()); nvgpu_log_info(g, "bar1 inst block ptr: 0x%08x", ptr_v); diff --git a/drivers/gpu/nvgpu/hal/bus/bus_gp10b_fusa.c b/drivers/gpu/nvgpu/hal/bus/bus_gp10b_fusa.c index b5a916a88..90f771a30 100644 --- a/drivers/gpu/nvgpu/hal/bus/bus_gp10b_fusa.c +++ b/drivers/gpu/nvgpu/hal/bus/bus_gp10b_fusa.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "bus_gp10b.h" @@ -34,7 +35,8 @@ int gp10b_bus_bar2_bind(struct gk20a *g, struct nvgpu_mem *bar2_inst) struct nvgpu_timeout timeout; int err = 0; u64 iova = nvgpu_inst_block_addr(g, bar2_inst); - u32 ptr_v = (u32)(iova >> bus_bar2_block_ptr_shift_v()); + u32 ptr_v = nvgpu_safe_cast_u64_to_u32(iova + >> bus_bar2_block_ptr_shift_v()); nvgpu_log_info(g, "bar2 inst block ptr: 0x%08x", ptr_v);