@@ -1295,20 +1295,21 @@ static int _of_init_opp_table_v2(struct device *dev,
if (WARN_ON(!count))
goto out;
- if (!ret) {
- if (!dev_opp) {
- dev_opp = _find_device_opp(dev);
- if (WARN_ON(!dev_opp))
- goto out;
- }
-
- dev_opp->np = opp_np;
- dev_opp->shared_opp = of_property_read_bool(opp_np,
- "opp-shared");
- } else {
+ if (ret) {
of_free_opp_table(dev);
+ goto out;
}
+ dev_opp = _find_device_opp(dev);
+ if (WARN_ON(!dev_opp)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ dev_opp->np = opp_np;
+ dev_opp->shared_opp = of_property_read_bool(opp_np,
+ "opp-shared");
+
out:
return ret;
}