From dafae9c5b39e2871bfd8db0b4bad6e850e42ef49 Mon Sep 17 00:00:00 2001
From: Georgi Djakov <georgi.djakov@linaro.org>
Date: Wed, 13 Jan 2016 15:10:25 +0200
Subject: cpufreq-dt: Add missing rcu_read_lock() for find_device_opp()

The function dev_pm_opp_get_notifier() must be called with held
rcu_read_lock. In order to keep the pointer valid, add rcu_read_lock().

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
 drivers/cpufreq/cpufreq-dt.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -359,14 +359,17 @@ static int cpufreq_init(struct cpufreq_p
 
 	mutex_init(&priv->lock);
 
+	rcu_read_lock();
 	opp_srcu_head = dev_pm_opp_get_notifier(cpu_dev);
 	if (IS_ERR(opp_srcu_head)) {
 		ret = PTR_ERR(opp_srcu_head);
+		rcu_read_unlock();
 		goto out_free_priv;
 	}
 
 	priv->opp_nb.notifier_call = opp_notifier;
 	ret = srcu_notifier_chain_register(opp_srcu_head, &priv->opp_nb);
+	rcu_read_unlock();
 	if (ret)
 		goto out_free_priv;
 
