diff --git a/drivers/gpu/nvgpu/common/gr/zbc.c b/drivers/gpu/nvgpu/common/gr/zbc.c index f0f6d832e..8299dfdc0 100644 --- a/drivers/gpu/nvgpu/common/gr/zbc.c +++ b/drivers/gpu/nvgpu/common/gr/zbc.c @@ -602,6 +602,10 @@ alloc_err: /* deallocate the memory for the struct */ void nvgpu_gr_zbc_deinit(struct gk20a *g, struct nvgpu_gr_zbc *zbc) { + if (zbc == NULL) { + return; + } + nvgpu_kfree(g, zbc->zbc_col_tbl); nvgpu_kfree(g, zbc->zbc_dep_tbl); nvgpu_kfree(g, zbc->zbc_s_tbl); diff --git a/drivers/gpu/nvgpu/common/gr/zcull.c b/drivers/gpu/nvgpu/common/gr/zcull.c index 511022239..e86cf9562 100644 --- a/drivers/gpu/nvgpu/common/gr/zcull.c +++ b/drivers/gpu/nvgpu/common/gr/zcull.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2021, 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 @@ exit: void nvgpu_gr_zcull_deinit(struct gk20a *g, struct nvgpu_gr_zcull *gr_zcull) { + if (gr_zcull == NULL) { + return; + } + nvgpu_kfree(g, gr_zcull); }