summaryrefslogtreecommitdiff
path: root/drivers/opp/of.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/opp/of.c')
-rw-r--r--drivers/opp/of.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 4a19f76880d3..aaa4bab69846 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -411,6 +411,8 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np,
ret = -ENOMEM;
else if (!opp_table->parsed_static_opps)
goto initialize_static_opps;
+ else
+ kref_get(&opp_table->list_kref);
goto put_opp_table;
}
@@ -420,6 +422,8 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np,
return -ENOMEM;
initialize_static_opps:
+ kref_init(&opp_table->list_kref);
+
/* We have opp-table node now, iterate over it and add OPPs */
for_each_available_child_of_node(opp_np, np) {
count++;
@@ -437,6 +441,7 @@ initialize_static_opps:
/* There should be one of more OPP defined */
if (WARN_ON(!count)) {
ret = -ENOENT;
+ _put_opp_list_kref(opp_table);
goto put_opp_table;
}
@@ -491,6 +496,8 @@ static int _of_add_opp_table_v1(struct device *dev)
if (!opp_table)
return -ENOMEM;
+ kref_init(&opp_table->list_kref);
+
val = prop->value;
while (nr) {
unsigned long freq = be32_to_cpup(val++) * 1000;