gpu: nvgpu: add null check for gp_get, pb_get

This patch adds NULL check for gp_get and pb_get.

JIRA NVGPU-9325

Change-Id: If41c1c526c58a18cc91a95686e71bdfae9edb328
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2836366
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Rajesh Devaraj
2023-01-03 06:39:38 +00:00
committed by mobile promotions
parent 2d3745810b
commit 2e36ad9e35
2 changed files with 15 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
/* /*
* GK20A Graphics channel * GK20A Graphics channel
* *
* Copyright (c) 2011-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2011-2023, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -441,9 +441,13 @@ clean_up:
static inline u32 channel_update_gpfifo_get(struct gk20a *g, static inline u32 channel_update_gpfifo_get(struct gk20a *g,
struct nvgpu_channel *c) struct nvgpu_channel *c)
{ {
u32 new_get = g->ops.userd.gp_get(g, c); u32 new_get = 0U;
if (g->ops.userd.gp_get != NULL) {
new_get = g->ops.userd.gp_get(g, c);
c->gpfifo.get = new_get;
}
c->gpfifo.get = new_get;
return new_get; return new_get;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015-2023, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -51,8 +51,13 @@ static struct nvgpu_channel_wdt_state nvgpu_channel_collect_wdt_state(
* accesses. The kernel mem for userd may not even exist; this * accesses. The kernel mem for userd may not even exist; this
* channel could be in usermode submit mode. * channel could be in usermode submit mode.
*/ */
state.gp_get = g->ops.userd.gp_get(g, ch); if (g->ops.userd.gp_get != NULL) {
state.pb_get = g->ops.userd.pb_get(g, ch); state.gp_get = g->ops.userd.gp_get(g, ch);
}
if (g->ops.userd.pb_get != NULL) {
state.pb_get = g->ops.userd.pb_get(g, ch);
}
} }
return state; return state;