Merge OPP updates for 7.3-rc3 from Viresh Kumar: "- Fix potential multiplication overflow when calculating freq in OPP core (Colin Ian King). - Fix use after free in _update_opp_table_clk() (Peter Griffin). - Use %pe to print symbolic error name (Sumeet Pawnikar)." * tag 'opp-updates-7.3.rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: opp: fix use after free in _update_opp_table_clk() opp: Use %pe to print symbolic error name OPP: of: Fix potential multiplication overflow when calculating freq
Unified · Split
| @@ -453,8 +453,8 @@ int dev_pm_opp_get_opp_count(struct device *dev) · 452 unmodified lines | |||
| 453 | _find_opp_table(dev); | 453 | _find_opp_table(dev); |
| 454 | 454 | ||
| 455 | if (IS_ERR(opp_table)) { | 455 | if (IS_ERR(opp_table)) { |
| 456 | dev_dbg(dev, "%s: OPP table not found (%ld)\n", | 456 | dev_dbg(dev, "%s: OPP table not found (%pe)\n", |
| 457 | __func__, PTR_ERR(opp_table)); | 457 | __func__, opp_table); |
| 458 | return PTR_ERR(opp_table); | 458 | return PTR_ERR(opp_table); |
| 459 | } | 459 | } |
| 460 | 460 | ||
| @@ -611,8 +611,8 @@ _find_key(struct device *dev, unsigned long *key, int index, bool available, · 150 unmodified lines | |||
| 611 | _find_opp_table(dev); | 611 | _find_opp_table(dev); |
| 612 | 612 | ||
| 613 | if (IS_ERR(opp_table)) { | 613 | if (IS_ERR(opp_table)) { |
| 614 | dev_err(dev, "%s: OPP table not found (%ld)\n", __func__, | 614 | dev_err(dev, "%s: OPP table not found (%pe)\n", __func__, |
| 615 | PTR_ERR(opp_table)); | 615 | opp_table); |
| 616 | return ERR_CAST(opp_table); | 616 | return ERR_CAST(opp_table); |
| 617 | } | 617 | } |
| 618 | 618 | ||
| @@ -722,8 +722,8 @@ struct dev_pm_opp *dev_pm_opp_find_key_exact(struct device *dev, · 103 unmodified lines | |||
| 722 | struct opp_table *opp_table __free(put_opp_table) = _find_opp_table(dev); | 722 | struct opp_table *opp_table __free(put_opp_table) = _find_opp_table(dev); |
| 723 | 723 | ||
| 724 | if (IS_ERR(opp_table)) { | 724 | if (IS_ERR(opp_table)) { |
| 725 | dev_err(dev, "%s: OPP table not found (%ld)\n", __func__, | 725 | dev_err(dev, "%s: OPP table not found (%pe)\n", __func__, |
| 726 | PTR_ERR(opp_table)); | 726 | opp_table); |
| 727 | return ERR_CAST(opp_table); | 727 | return ERR_CAST(opp_table); |
| 728 | } | 728 | } |
| 729 | 729 | ||
| @@ -1036,8 +1036,8 @@ static int _set_opp_voltage(struct device *dev, struct regulator *reg, · 306 unmodified lines | |||
| 1036 | 1036 | ||
| 1037 | /* Regulator not available for device */ | 1037 | /* Regulator not available for device */ |
| 1038 | if (IS_ERR(reg)) { | 1038 | if (IS_ERR(reg)) { |
| 1039 | dev_dbg(dev, "%s: regulator not available: %ld\n", __func__, | 1039 | dev_dbg(dev, "%s: regulator not available: %pe\n", __func__, |
| 1040 | PTR_ERR(reg)); | 1040 | reg); |
| 1041 | return 0; | 1041 | return 0; |
| 1042 | } | 1042 | } |
| 1043 | 1043 | ||
| @@ -1448,8 +1448,8 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) · 404 unmodified lines | |||
| 1448 | temp_freq = freq; | 1448 | temp_freq = freq; |
| 1449 | opp = _find_freq_ceil(opp_table, &temp_freq); | 1449 | opp = _find_freq_ceil(opp_table, &temp_freq); |
| 1450 | if (IS_ERR(opp)) { | 1450 | if (IS_ERR(opp)) { |
| 1451 | dev_err(dev, "%s: failed to find OPP for freq %lu (%ld)\n", | 1451 | dev_err(dev, "%s: failed to find OPP for freq %lu (%pe)\n", |
| 1452 | __func__, freq, PTR_ERR(opp)); | 1452 | __func__, freq, opp); |
| 1453 | return PTR_ERR(opp); | 1453 | return PTR_ERR(opp); |
| 1454 | } | 1454 | } |
| 1455 | 1455 | ||
| @@ -1581,6 +1581,8 @@ static struct opp_table *_update_opp_table_clk(struct device *dev, · 125 unmodified lines | |||
| 1581 | struct opp_table *opp_table, | 1581 | struct opp_table *opp_table, |
| 1582 | bool getclk) | 1582 | bool getclk) |
| 1583 | { | 1583 | { |
| 1584 | int ret; | ||
| 1585 | |||
| 1584 | /* | 1586 | /* |
| 1585 | * Return early if we don't need to get clk or we have already done it | 1587 | * Return early if we don't need to get clk or we have already done it |
| 1586 | * earlier. | 1588 | * earlier. |
| @@ -1607,9 +1609,9 @@ static struct opp_table *_update_opp_table_clk(struct device *dev, · 20 unmodified lines | |||
| 1607 | opp_table->clk = clk_get_optional(dev, NULL); | 1609 | opp_table->clk = clk_get_optional(dev, NULL); |
| 1608 | 1610 | ||
| 1609 | if (IS_ERR(opp_table->clk)) { | 1611 | if (IS_ERR(opp_table->clk)) { |
| 1612 | ret = dev_err_probe(dev, PTR_ERR(opp_table->clk), "Couldn't find clock\n"); | ||
| 1610 | dev_pm_opp_put_opp_table(opp_table); | 1613 | dev_pm_opp_put_opp_table(opp_table); |
| 1611 | dev_err_probe(dev, PTR_ERR(opp_table->clk), "Couldn't find clock\n"); | 1614 | return ERR_PTR(ret); |
| 1612 | return ERR_CAST(opp_table->clk); | ||
| 1613 | } | 1615 | } |
| 1614 | 1616 | ||
| 1615 | if (opp_table->clk) | 1617 | if (opp_table->clk) |
| @@ -2869,8 +2871,8 @@ static int _opp_set_availability(struct device *dev, unsigned long freq, · 1253 unmodified lines | |||
| 2869 | struct dev_pm_opp *opp __free(put_opp) = ERR_PTR(-ENODEV), *tmp_opp; | 2871 | struct dev_pm_opp *opp __free(put_opp) = ERR_PTR(-ENODEV), *tmp_opp; |
| 2870 | 2872 | ||
| 2871 | if (IS_ERR(opp_table)) { | 2873 | if (IS_ERR(opp_table)) { |
| 2872 | dev_warn(dev, "%s: Device OPP not found (%ld)\n", __func__, | 2874 | dev_warn(dev, "%s: Device OPP not found (%pe)\n", __func__, |
| 2873 | PTR_ERR(opp_table)); | 2875 | opp_table); |
| 2874 | return PTR_ERR(opp_table); | 2876 | return PTR_ERR(opp_table); |
| 2875 | } | 2877 | } |
| 2876 | 2878 | ||
| @@ -1039,7 +1039,7 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) · 1038 unmodified lines | |||
| 1039 | 1039 | ||
| 1040 | val = prop->value; | 1040 | val = prop->value; |
| 1041 | while (nr) { | 1041 | while (nr) { |
| 1042 | unsigned long freq = be32_to_cpup(val++) * 1000; | 1042 | unsigned long freq = (unsigned long)be32_to_cpup(val++) * 1000; |
| 1043 | unsigned long volt = be32_to_cpup(val++); | 1043 | unsigned long volt = be32_to_cpup(val++); |
| 1044 | struct dev_pm_opp_data data = { | 1044 | struct dev_pm_opp_data data = { |
| 1045 | .freq = freq, | 1045 | .freq = freq, |
| @@ -1345,8 +1345,8 @@ int of_get_required_opp_performance_state(struct device_node *np, int index) · 299 unmodified lines | |||
| 1345 | _find_table_of_opp_np(required_np); | 1345 | _find_table_of_opp_np(required_np); |
| 1346 | 1346 | ||
| 1347 | if (IS_ERR(opp_table)) { | 1347 | if (IS_ERR(opp_table)) { |
| 1348 | pr_err("%s: Failed to find required OPP table %pOF: %ld\n", | 1348 | pr_err("%s: Failed to find required OPP table %pOF: %pe\n", |
| 1349 | __func__, np, PTR_ERR(opp_table)); | 1349 | __func__, np, opp_table); |
| 1350 | return PTR_ERR(opp_table); | 1350 | return PTR_ERR(opp_table); |
| 1351 | } | 1351 | } |
| 1352 | 1352 | ||