From 69adc6c91d1976fbba8e9745d40e5ef81422edc0 Mon Sep 17 00:00:00 2001 From: Rajesh Devaraj Date: Wed, 9 Nov 2022 18:08:09 +0000 Subject: [PATCH] gpu: nvgpu: add null check for mssnvlink hals Add NULL check for mssnvlink related HALs. JIRA NVGPU-9263 Change-Id: I418191c11aabdb614255220d4e26120e9301a2d2 Signed-off-by: Rajesh Devaraj Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2806101 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: svc-mobile-misra Reviewed-by: Seema Khowala GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/hal/fb/fb_ga10b_fusa.c | 6 ++++-- drivers/gpu/nvgpu/hal/mssnvlink/mssnvlink_ga10b.c | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/fb/fb_ga10b_fusa.c b/drivers/gpu/nvgpu/hal/fb/fb_ga10b_fusa.c index 982e244ee..18b08e122 100644 --- a/drivers/gpu/nvgpu/hal/fb/fb_ga10b_fusa.c +++ b/drivers/gpu/nvgpu/hal/fb/fb_ga10b_fusa.c @@ -1,7 +1,7 @@ /* * GA10B FB * - * Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -150,7 +150,9 @@ void ga10b_fb_init_fs_state(struct gk20a *g) nvgpu_log(g, gpu_dbg_fn, "initialize ga10b fb"); #if defined(CONFIG_NVGPU_HAL_NON_FUSA) - g->ops.mssnvlink.init_soc_credits(g); + if (g->ops.mssnvlink.init_soc_credits != NULL) { + g->ops.mssnvlink.init_soc_credits(g); + } #endif ga10b_fb_check_ltcs_count(g); diff --git a/drivers/gpu/nvgpu/hal/mssnvlink/mssnvlink_ga10b.c b/drivers/gpu/nvgpu/hal/mssnvlink/mssnvlink_ga10b.c index c606aa7ae..1e2689827 100644 --- a/drivers/gpu/nvgpu/hal/mssnvlink/mssnvlink_ga10b.c +++ b/drivers/gpu/nvgpu/hal/mssnvlink/mssnvlink_ga10b.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -72,6 +72,10 @@ void ga10b_mssnvlink_init_soc_credits(struct gk20a *g) uintptr_t mssnvlink_control[MSS_NVLINK_INTERNAL_NUM]; + if (g->ops.mssnvlink.get_links == NULL) { + return; + } + if (nvgpu_platform_is_simulation(g)) { nvgpu_log(g, gpu_dbg_info, "simulation platform: " "nvlink soc credits not required");