diff --git a/drivers/gpu/nvgpu/common/enabled.c b/drivers/gpu/nvgpu/common/enabled.c index 06cbbe34b..cded36c88 100644 --- a/drivers/gpu/nvgpu/common/enabled.c +++ b/drivers/gpu/nvgpu/common/enabled.c @@ -40,6 +40,14 @@ int nvgpu_init_enabled_flags(struct gk20a *g) return 0; } +/* + * Call this on driver shutdown! + */ +void nvgpu_free_enabled_flags(struct gk20a *g) +{ + nvgpu_kfree(g, g->enabled_flags); +} + bool nvgpu_is_enabled(struct gk20a *g, int flag) { return test_bit(flag, g->enabled_flags); diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 5d91da8fe..cc2b5ec77 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -673,6 +673,8 @@ void gk20a_remove_support(struct gk20a *g) #ifdef CONFIG_TEGRA_19x_GPU t19x_remove_support(g); #endif + + nvgpu_free_enabled_flags(g); } static int gk20a_init_support(struct platform_device *dev) diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h index e7dd61d27..001cafb00 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h +++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h @@ -170,5 +170,6 @@ bool nvgpu_is_enabled(struct gk20a *g, int flag); bool __nvgpu_set_enabled(struct gk20a *g, int flag, bool state); int nvgpu_init_enabled_flags(struct gk20a *g); +void nvgpu_free_enabled_flags(struct gk20a *g); #endif