From ce32b25751c704050f4992c8e33b015c909fc808 Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Mon, 10 Nov 2014 10:03:54 +0200 Subject: 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 Reviewed-on: http://git-master/r/599370 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Mohan Nimaje --- drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/debug_gk20a.c') 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) }; /* Dump the first device if no info is provided */ - if (!pdev && gk20a_device) + if (!pdev) { + if (!gk20a_device) + return; + pdev = gk20a_device; + } gk20a_debug_show_dump(pdev, &o); } -- cgit v1.2.2