From cb46fc6e254dbd7d0fdb2192343b89cf7b7b6c70 Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Tue, 28 Apr 2020 13:28:15 -0600 Subject: [PATCH] msm: kgsl: Check for an OPP table without accidentally creating one Commit 789e044344f3 ("msm: kgsl: Don't populate the OPP table if it already exists") tried to avoid duplicating the OPP table but used dev_pm_opp_get_opp_table() which creates a table if it didn't already exist so the if() check was always true and we never populated the table which in turn caused devfreq to fail because the table was empty. All we really wanted to do was check to see if the table existed without a nasty message from the OPP subsystem. Checking dev_pm_opp_get_opp_count() should do that without any ugly side effects. Change-Id: Ic0dedbadf81a1917b756144e762a6600a84863ca Signed-off-by: Jordan Crouse --- drivers/gpu/msm/adreno.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index fd3a2c378442..7ca14e24d31d 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -779,14 +779,11 @@ static const struct of_device_id adreno_match_table[] = { /* Dynamically build the OPP table for the GPU device */ static void adreno_build_opp_table(struct device *dev, struct kgsl_pwrctrl *pwr) { - struct opp_table *table; int i; - table = dev_pm_opp_get_opp_table(dev); - if (table) { - dev_pm_opp_put_opp_table(table); + /* Skip if the table has already been populated */ + if (dev_pm_opp_get_opp_count(dev) > 0) return; - } /* Add all the supported frequencies into the tree */ for (i = 0; i < pwr->num_pwrlevels; i++)