mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: assert gr dev is non-NULL
nvgpu_device_get can return NULL if supplied invalid ID or instance ID. We expect GR device struct to be non-NULL there hence just assert that it is indeed non-NULL in gr_reset_engine and ga10b_grmgr_init_gr_manager. CID 224133 CID 250232 Bug 3512546 Change-Id: Id09a1c436a8e49b921111b940d3d013bd66bff7a Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2707018 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
c1202d7283
commit
9d6269ce7f
@@ -620,6 +620,8 @@ static int gr_reset_engine(struct gk20a *g)
|
||||
nvgpu_device_get(g, NVGPU_DEVTYPE_GRAPHICS,
|
||||
nvgpu_gr_get_syspipe_id(g, g->mig.cur_gr_instance));
|
||||
|
||||
nvgpu_assert(dev != NULL);
|
||||
|
||||
nvgpu_log(g, gpu_dbg_gr, "Reset GR%u", cur_gr_instance_id);
|
||||
|
||||
/* Reset GR engine: Disable then enable GR engine */
|
||||
|
||||
@@ -803,6 +803,8 @@ int ga10b_grmgr_init_gr_manager(struct gk20a *g)
|
||||
gr_dev = nvgpu_device_get(g, NVGPU_DEVTYPE_GRAPHICS,
|
||||
gr_syspipe->gr_syspipe_id);
|
||||
|
||||
nvgpu_assert(gr_dev != NULL);
|
||||
|
||||
/*
|
||||
* HW recommended to put GR engine into reset before programming
|
||||
* config_gpc_rs_map (ga10b_grmgr_config_gpc_smc_map()).
|
||||
|
||||
Reference in New Issue
Block a user