gpu: nvgpu: Use perf table only VBIOS supports it

We retrieve perf table from VBIOS only if respective HAL op is
implemented. Later in code we unconditionally dereference the pointer
which can lead to NULL pointer access.

Fix by early aborting creation of devinit tables if the perf VBIOS
getter is missing.

Change-Id: If48aa6dac724056dd1feb2ef520e343736d4db85
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1279223
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
This commit is contained in:
Terje Bergstrom
2016-12-20 14:11:54 -08:00
committed by mobile promotions
parent 2a95a288b2
commit f37f4e27e3
10 changed files with 88 additions and 77 deletions

View File

@@ -140,13 +140,14 @@ static u32 devinit_get_pwr_device_table(struct gk20a *g,
gk20a_dbg_info("");
if (g->ops.bios.get_perf_table_ptrs != NULL) {
pwr_device_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
g->bios.perf_token, POWER_SENSORS_TABLE);
if (pwr_device_table_ptr == NULL) {
status = -EINVAL;
goto done;
}
if (!g->ops.bios.get_perf_table_ptrs)
return -EINVAL;
pwr_device_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
g->bios.perf_token, POWER_SENSORS_TABLE);
if (pwr_device_table_ptr == NULL) {
status = -EINVAL;
goto done;
}
memcpy(&pwr_sensor_table_header, pwr_device_table_ptr,