summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-11-10 03:03:54 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:12:10 -0400
commitce32b25751c704050f4992c8e33b015c909fc808 (patch)
tree1250128861f5bdf07a22915375fbaef3102cf31b /drivers/gpu/nvgpu/gk20a/debug_gk20a.c
parentff1b2fc1e84fbac147e144d3c8d80104b7eca5e9 (diff)
gpu: nvgpu: Add NULL pointer check to debug code
nvgpu exposes debug dump functionality. Currently this function misses NULL pointer checks and therefore in cases where the driver is compiled but the device is disabled, the driver crashes kernel. This patch adds the missing NULL pointer check. Change-Id: I32acb5cad62b2a29603d6439a5c7e45e016235dd Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/599370 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Mohan Nimaje <mnimaje@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/debug_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/debug_gk20a.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
index 676b493b..602d713b 100644
--- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
@@ -252,8 +252,12 @@ void gk20a_debug_dump_device(struct platform_device *pdev)
252 }; 252 };
253 253
254 /* Dump the first device if no info is provided */ 254 /* Dump the first device if no info is provided */
255 if (!pdev && gk20a_device) 255 if (!pdev) {
256 if (!gk20a_device)
257 return;
258
256 pdev = gk20a_device; 259 pdev = gk20a_device;
260 }
257 261
258 gk20a_debug_show_dump(pdev, &o); 262 gk20a_debug_show_dump(pdev, &o);
259} 263}