diff options
author | Alvin Park <apark@nvidia.com> | 2020-12-14 20:34:44 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2020-12-16 12:09:13 -0500 |
commit | 438215b056feef0861b07b9111a1e6438dfc290e (patch) | |
tree | 1e715aa3e0e8ecfacc05470188b8334f25c8b054 /drivers/gpu/nvgpu | |
parent | 7bf2833f340f87ea643d3ef66b0e4c22ffb1e891 (diff) |
gpu: nvgpu: add check for is_railgated
When try to read '/sys/kernel/debug/gpu.0/railgate_residency'
debug fs node, NULL pointer access error can be happened if
is_railgated function is not assinged.
Add check for is_railgated before calling the function pointer.
Bug 200682233
Change-Id: I4a03d4e19b04d02815b792d7d967d4a1d5f42c35
Signed-off-by: Alvin Park <apark@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2459751
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Hardik T Shah <hardikts@nvidia.com>
Reviewed-by: Phoenix Jung <pjung@nvidia.com>
Reviewed-by: Jay Kumar Bajaj <jbajaj@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/debug.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/debug.c b/drivers/gpu/nvgpu/os/linux/debug.c index 5f0703c8..d7e3f1e7 100644 --- a/drivers/gpu/nvgpu/os/linux/debug.c +++ b/drivers/gpu/nvgpu/os/linux/debug.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2017-2018 NVIDIA Corporation. All rights reserved. | 2 | * Copyright (C) 2017-2020 NVIDIA Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is licensed under the terms of the GNU General Public | 4 | * This software is licensed under the terms of the GNU General Public |
5 | * License version 2, as published by the Free Software Foundation, and | 5 | * License version 2, as published by the Free Software Foundation, and |
@@ -224,7 +224,7 @@ static int railgate_residency_show(struct seq_file *s, void *data) | |||
224 | unsigned long total_rail_gate_time_ms; | 224 | unsigned long total_rail_gate_time_ms; |
225 | unsigned long total_rail_ungate_time_ms; | 225 | unsigned long total_rail_ungate_time_ms; |
226 | 226 | ||
227 | if (platform->is_railgated(dev_from_gk20a(g))) { | 227 | if (platform->is_railgated && platform->is_railgated(dev_from_gk20a(g))) { |
228 | time_since_last_state_transition_ms = | 228 | time_since_last_state_transition_ms = |
229 | jiffies_to_msecs(jiffies - | 229 | jiffies_to_msecs(jiffies - |
230 | g->pstats.last_rail_gate_complete); | 230 | g->pstats.last_rail_gate_complete); |