From cbde6ba274002972377247da402080e310c23df8 Mon Sep 17 00:00:00 2001 From: Johnny Liu Date: Thu, 19 Oct 2023 07:25:22 +0000 Subject: [PATCH] gpu: host1x: NULL check before get_rate Avoid calling get_rate function pointer when it is not supported by the client driver. Bug 4338396 Signed-off-by: Johnny Liu Change-Id: Iee7f26865d82235de7a5b41347546c1195a7ea48 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3000315 Reviewed-by: Mikko Perttunen GVS: Gerrit_Virtual_Submit --- drivers/gpu/host1x/actmon.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/host1x/actmon.c b/drivers/gpu/host1x/actmon.c index 51c22310..63974811 100644 --- a/drivers/gpu/host1x/actmon.c +++ b/drivers/gpu/host1x/actmon.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -191,6 +192,9 @@ static int host1x_actmon_module_avg_norm_get(void *data, u64 *val) unsigned long client_freq; u32 active_clks, client_clks; + if (!client->ops->get_rate) + return -ENOTSUPP; + active_clks = actmon_module_readl(module, HOST1X_ACTMON_MODULE_AVG_COUNT_REG); client_freq = client->ops->get_rate(client);