summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_vin.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-12-20 17:11:54 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-04 04:44:25 -0500
commitf37f4e27e362629d5c187817104d48d703c380cc (patch)
tree8dddaa1d926016848c6cebc4aa9f4a3612341da1 /drivers/gpu/nvgpu/clk/clk_vin.c
parent2a95a288b285b0eff16a8825298c416d185693fb (diff)
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>
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_vin.c')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_vin.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_vin.c b/drivers/gpu/nvgpu/clk/clk_vin.c
index e8e4b753..649eb234 100644
--- a/drivers/gpu/nvgpu/clk/clk_vin.c
+++ b/drivers/gpu/nvgpu/clk/clk_vin.c
@@ -339,13 +339,14 @@ static u32 devinit_get_vin_device_table(struct gk20a *g,
339 339
340 gk20a_dbg_info(""); 340 gk20a_dbg_info("");
341 341
342 if (g->ops.bios.get_perf_table_ptrs) { 342 if (!g->ops.bios.get_perf_table_ptrs)
343 vin_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g, 343 return -EINVAL;
344 g->bios.clock_token, VIN_TABLE); 344
345 if (vin_table_ptr == NULL) { 345 vin_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
346 status = -1; 346 g->bios.clock_token, VIN_TABLE);
347 goto done; 347 if (vin_table_ptr == NULL) {
348 } 348 status = -1;
349 goto done;
349 } 350 }
350 351
351 memcpy(&vin_desc_table_header, vin_table_ptr, 352 memcpy(&vin_desc_table_header, vin_table_ptr,