Skip to content

Commit

Permalink
mali/midgard: devfreq: fix for double locking _find_opp_table()
Browse files Browse the repository at this point in the history
After commit 5b650b3, _find_opp_table()
increments the reference under the opp_table_lock.
So now there is no need to take the opp_table_lock or rcu_read_lock().
This patch drops the rcu_read_lock() around _find_opp_table() in the
mali midgard r20p0 drivers.

Signed-off-by: memeka <mihailescu2m@gmail.com>
  • Loading branch information
mihailescu2m committed Jul 11, 2018
1 parent debf4ca commit bbe73c3
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
Expand Up @@ -89,10 +89,8 @@ kbase_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)

freq = *target_freq;

rcu_read_lock();
opp = devfreq_recommended_opp(dev, &freq, flags);
voltage = dev_pm_opp_get_voltage(opp);
rcu_read_unlock();
if (IS_ERR_OR_NULL(opp)) {
dev_err(dev, "Failed to get opp (%ld)\n", PTR_ERR(opp));
return PTR_ERR(opp);
Expand Down Expand Up @@ -215,28 +213,23 @@ static int kbase_devfreq_init_freq_table(struct kbase_device *kbdev,
unsigned long freq;
struct dev_pm_opp *opp;

rcu_read_lock();
count = dev_pm_opp_get_opp_count(kbdev->dev);
if (count < 0) {
rcu_read_unlock();
return count;
}
rcu_read_unlock();

dp->freq_table = kmalloc_array(count, sizeof(dp->freq_table[0]),
GFP_KERNEL);
if (!dp->freq_table)
return -ENOMEM;

rcu_read_lock();
for (i = 0, freq = ULONG_MAX; i < count; i++, freq--) {
opp = dev_pm_opp_find_freq_floor(kbdev->dev, &freq);
if (IS_ERR(opp))
break;

dp->freq_table[i] = freq;
}
rcu_read_unlock();

if (count != i)
dev_warn(kbdev->dev, "Unable to enumerate all OPPs (%d!=%d\n",
Expand Down

0 comments on commit bbe73c3

Please sign in to comment.